added global vars to mqtt_on_message
Signed-off-by: Ebbe Baß <ebbe@ping-mee.de>master
parent
cf5224c8a3
commit
f31f971e63
5
main.py
5
main.py
|
@ -168,19 +168,24 @@ if __name__ == '__main__':
|
||||||
topic = str(msg.topic)
|
topic = str(msg.topic)
|
||||||
payload = str(msg.payload.decode("utf-8"))
|
payload = str(msg.payload.decode("utf-8"))
|
||||||
if topic == "server-rack-led-1/power":
|
if topic == "server-rack-led-1/power":
|
||||||
|
global power
|
||||||
power = payload
|
power = payload
|
||||||
|
|
||||||
elif topic == "server-rack-led-1/r":
|
elif topic == "server-rack-led-1/r":
|
||||||
|
global r
|
||||||
r = payload
|
r = payload
|
||||||
|
|
||||||
elif topic == "server-rack-led-1/g":
|
elif topic == "server-rack-led-1/g":
|
||||||
|
global g
|
||||||
g = payload
|
g = payload
|
||||||
|
|
||||||
elif topic == "server-rack-led-1/b":
|
elif topic == "server-rack-led-1/b":
|
||||||
|
global b
|
||||||
b = payload
|
b = payload
|
||||||
|
|
||||||
elif topic == "server-rack-led-1/mode":
|
elif topic == "server-rack-led-1/mode":
|
||||||
if payload == "0":
|
if payload == "0":
|
||||||
|
global mode
|
||||||
mode = 0
|
mode = 0
|
||||||
elif payload == "1":
|
elif payload == "1":
|
||||||
mode = 1
|
mode = 1
|
||||||
|
|
Loading…
Reference in New Issue