Loading core.py +6 −0 Original line number Diff line number Diff line Loading @@ -98,6 +98,12 @@ class Eins: if self._connected: self._online_register_command(command) def emit_cmd(self, cmd_name, **data): self._mqttc.publish(topic = "edi/cmd/{}".format(cmd_name), payload = json.dumps(data), qos = self._pub_qos) #TODO: on_publish def _online_register_command(self, command): """Internal runtime command registration function. Loading tests/test_core.py +5 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ def on_connect(): @eins.handle_cmd def test_running(): print("Test running called!") eins.on_connect = on_connect @eins.handle_cmd("print") def cmd_print(a): Loading @@ -41,6 +42,9 @@ def ètoile(): def brøther(): print("LÂMP") eins.on_connect = on_connect @eins.handle_cmd() def reflector(**kwargs): del kwargs['mqtt_topic'] eins.emit_cmd("reflector-target", **kwargs) eins.run() Loading
core.py +6 −0 Original line number Diff line number Diff line Loading @@ -98,6 +98,12 @@ class Eins: if self._connected: self._online_register_command(command) def emit_cmd(self, cmd_name, **data): self._mqttc.publish(topic = "edi/cmd/{}".format(cmd_name), payload = json.dumps(data), qos = self._pub_qos) #TODO: on_publish def _online_register_command(self, command): """Internal runtime command registration function. Loading
tests/test_core.py +5 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ def on_connect(): @eins.handle_cmd def test_running(): print("Test running called!") eins.on_connect = on_connect @eins.handle_cmd("print") def cmd_print(a): Loading @@ -41,6 +42,9 @@ def ètoile(): def brøther(): print("LÂMP") eins.on_connect = on_connect @eins.handle_cmd() def reflector(**kwargs): del kwargs['mqtt_topic'] eins.emit_cmd("reflector-target", **kwargs) eins.run()