Add MQTT publish JSON action and subscribe JSON trigger (#193)

* Add MQTT publish JSON action and subscribe JSON trigger

* Lint
This commit is contained in:
Otto Winter
2018-10-20 12:41:00 +02:00
committed by GitHub
parent 81bc400340
commit 629f2b128e
11 changed files with 233 additions and 140 deletions
+16
View File
@@ -1,3 +1,6 @@
from __future__ import print_function
class Registry(dict):
def register(self, name):
def decorator(fun):
@@ -14,3 +17,16 @@ class ServiceRegistry(dict):
return fun
return decorator
def safe_print(message=""):
try:
print(message)
return
except UnicodeEncodeError:
pass
try:
print(message.encode('ascii', 'backslashreplace'))
except UnicodeEncodeError:
print("Cannot print line because of invalid locale!")