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)
|
||||
payload = str(msg.payload.decode("utf-8"))
|
||||
if topic == "server-rack-led-1/power":
|
||||
global power
|
||||
power = payload
|
||||
|
||||
elif topic == "server-rack-led-1/r":
|
||||
global r
|
||||
r = payload
|
||||
|
||||
elif topic == "server-rack-led-1/g":
|
||||
global g
|
||||
g = payload
|
||||
|
||||
elif topic == "server-rack-led-1/b":
|
||||
global b
|
||||
b = payload
|
||||
|
||||
elif topic == "server-rack-led-1/mode":
|
||||
if payload == "0":
|
||||
global mode
|
||||
mode = 0
|
||||
elif payload == "1":
|
||||
mode = 1
|
||||
|
|
Loading…
Reference in New Issue