mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-05-26 07:38:30 +02:00
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:
@@ -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!")
|
||||
|
||||
Reference in New Issue
Block a user