Init commit for python scripts

This commit is contained in:
Jaro
2020-10-30 19:21:36 +01:00
commit 552ae66601
6 changed files with 594 additions and 0 deletions

20
mqtt_print.py Normal file
View File

@@ -0,0 +1,20 @@
#!/usr/bin/python3
opt = { "color" : ("c",1), "time_on" : ("on",1000), "time_off": ("off",1000), "brightness": ("b",10), "speed" : ("s",100) }
def get_message(msg,**kwargs):
print("Sending, message to mqtt")
param = []
for item in kwargs.keys():
if item in opt:
param.append(opt[item][0])
param.append(kwargs[item])
parameter = ':'.join(list(map(lambda x: str(x), param)))
if len(parameter):
return parameter + ';' + msg
else:
return msg