I have 8 switches and I need to send the command of each switch (1/0) in json like this by MQTT. In my example it goes Switch1, Switch2, Switch3…Switch8. All separated by a comma and space
I know how to send correctly the switch command for one switch, but how for 8 together? Need to send on every time one of the 8 switches is operated and periodically.
State ON ="1"
State OFF ="0"
{"data": [0, 1, 0, 0, 0, 1, 0, 1] };
I’m thinking something like [Switch1.state, Switch2.state, … Switch8.state]