power: register websocket notification
Change event prefix from "gpio_power" to "power". Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
537ba281ab
commit
b89aa77bc9
|
@ -59,6 +59,7 @@ class PrinterPower:
|
||||||
"set_device_power", self.set_device_power)
|
"set_device_power", self.set_device_power)
|
||||||
self.server.register_event_handler(
|
self.server.register_event_handler(
|
||||||
"server:klippy_shutdown", self._handle_klippy_shutdown)
|
"server:klippy_shutdown", self._handle_klippy_shutdown)
|
||||||
|
self.server.register_notification("power:power_changed")
|
||||||
IOLoop.current().spawn_callback(
|
IOLoop.current().spawn_callback(
|
||||||
self._initalize_devices, list(self.devices.values()))
|
self._initalize_devices, list(self.devices.values()))
|
||||||
|
|
||||||
|
@ -119,7 +120,7 @@ class PrinterPower:
|
||||||
if asyncio.iscoroutine(ret):
|
if asyncio.iscoroutine(ret):
|
||||||
await ret
|
await ret
|
||||||
dev_info = device.get_device_info()
|
dev_info = device.get_device_info()
|
||||||
self.server.send_event("gpio_power:power_changed", dev_info)
|
self.server.send_event("power:power_changed", dev_info)
|
||||||
device.run_power_changed_action()
|
device.run_power_changed_action()
|
||||||
elif req == "status":
|
elif req == "status":
|
||||||
ret = device.refresh_status()
|
ret = device.refresh_status()
|
||||||
|
|
Loading…
Reference in New Issue