Using switch node to show actual state


Using elements of the switch node example - Examples of Colour change button and switch, I've updated my relayboard dashboard, so that the actual, not the expected status is shown by the switch.

  • Flicking a switch sends a MQTT msg to the (ESP8266) Relayboard which energises a relay.
  • 100ms later, the flow sends a 'status' MQTT request of the relayboard.
  • The 'status' msg response is received by the flow, which is saved to flow context, and also changes the icon colour to indicate the 'real' status.

Without this, if communication failed between client & broker, the relay would not be energised, whilst the dashboard switch would indicate otherwise.

Further thought to be given to the benefits of using buttons instead of switches.


Examples of Colour change button and switch