21 lines
486 B
Python
21 lines
486 B
Python
#!/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
|
|
|
|
|