I have a controller that needs messages comprised of four bytes; two bytes nominate the light, the other two byte nominate how long it should stay on.
E.g. 0123 means light 1, on for 23 minutes; 0100 means light 1 off
Since there will be a random number of lights per controller (and a huge number [0-99] of minutes I see no point in using transformations), I’d like to use a switch item sending these commands out to the controller… and as an alternative build these strings via rules.
The MQTT command for the switch works:
But what if I want to include a setpoint value in the MQTT?
The setpoint would allow to adjust the minute value.
I guess this is only possible with rules?!
Now pretty sure this needs rules, in particular when single digit value need a leading zero.
Whether the thing is a light or valve does not really matter; I am already using some timer code to loop through the ‘things’. However, constructing the strings for the MQTT message is the problem.
Anyone done something like this and are keen to share? Thanks.