I wanted iot-dash to be interactive. Clicking on a device should toggle activation. For that, I edited MqttPlugin by fvanroie to support QOS values and retained flags. I also added the feature of executing bangs correctly. This is useful when using
!CommandMeasure. The updated version can be found on GitHub.
With the iot-dash skin, you can now click on the name of your device to send a predefined message per state (e.g. online, active). This way you can implement toggling, but also disable the link if the device is offline or disabled.
Essentially, you can add a bang to the
LeftMouseUpAction to send the right message at the right state. Note that setting the value to an empty string disables the link from being clickable. The following lines of code illustrate how this behaviour was implemented for the Coffee Machine.
In the case of the Bell (which rings if it receives a certain message), there is no need to implement toggling behaviour.
; This section changes the state IfCondition = (mqttTopicCoffee = 1) IfTrueAction = [!SetVariable stateCoffee #colorOnline#] [!SetOption meterCoffee LeftMouseUpAction "[!CommandMeasure mqttServer Publish(bridge/coffee/status,1,0,1)]"] IfFalseAction = [!SetVariable stateCoffee #colorOffline#] [!SetOption meterCoffee LeftMouseUpAction ""] IfCondition2 = (ConnectionMeasure = 0) IfTrueAction2 = [!SetVariable stateCoffee #colorDisabled#] [!SetOption meterCoffee LeftMouseUpAction ""] IfConditionMode=1
IfCondition = (mqttTopicCoffeeState = 1) IfTrueAction= [!SetVariable stateCoffee #colorActive#] [!SetOption meterCoffee LeftMouseUpAction "[!CommandMeasure mqttServer Publish(bridge/coffee/status,0,0,1)]"] IfConditionMode=1
1 thought on “iot-dash: v.1.1, publish messages”