Init commit for python scripts
This commit is contained in:
20
mqtt_print.py
Normal file
20
mqtt_print.py
Normal 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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user