via MQTT-subscription: LED ON/OFF
Posted: 23 Mar 2023, 09:25
First off:
What's the best practise for sending to MQTT-topic 0:OFF and 1:ON for LED attached to an GPIO-port of an ESP?
What I did now:
1. added an MQTT device "ampelMQTT" listening to MQTT topic(s) and writing their payload to a variables: Ampel1, Ampel2
2. I send for each "traffic light"(aka Ampel in German): 0:green,1:red,2:yellow
3. the variables get updated in the Device/Value overview
4. I tried to add a rule:
So, my log shows this:
So, for me the rule is not triggered? but how is this?
Thanks for your help!
What's the best practise for sending to MQTT-topic 0:OFF and 1:ON for LED attached to an GPIO-port of an ESP?
What I did now:
1. added an MQTT device "ampelMQTT" listening to MQTT topic(s) and writing their payload to a variables: Ampel1, Ampel2
2. I send for each "traffic light"(aka Ampel in German): 0:green,1:red,2:yellow
3. the variables get updated in the Device/Value overview
4. I tried to add a rule:
Code: Select all
On ampelMQTT#Ampel1 Do
logentry,"MQTT import Ampel1Gruen: %eventvalue1%"
If %eventvalue1%=0
GPIO,14,1
Else
GPIO,14,0
Endif
If %eventvalue1%=1
GPIO,13,1
Else
GPIO,13,0
Endif
Endon
Code: Select all
3973110 : Info : WD : Uptime 66 ConnectFailures 0 FreeMem 17256 WiFiStatus WL_CONNECTED 3 ESPeasy internal wifi status: Conn. IP Init
3976473 : Info : IMPT : [ampelMQTT#Ampel1] : 0.00
3980722 : Info : IMPT : [ampelMQTT#Ampel1] : 1.00
Thanks for your help!