Skip to content
This repository was archived by the owner on Apr 11, 2025. It is now read-only.

Commit 884033c

Browse files
authored
feat: rebuild device list (#63)
2 parents 54ae6b7 + b00a31d commit 884033c

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

ovos_PHAL_plugin_homeassistant/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ def __init__(self, bus=None, config=None):
9797
self.bus.on("ovos.phal.plugin.homeassistant.get.light.color", self.handle_get_light_color)
9898
self.bus.on("ovos.phal.plugin.homeassistant.set.light.color", self.handle_set_light_color)
9999
self.bus.on("ovos.phal.plugin.homeassistant.check_connected", self.handle_check_connected)
100+
self.bus.on("ovos.phal.plugin.homeassistant.rebuild.device.list", self.build_devices)
100101

101102
# GUI EVENTS
102103
self.bus.on("ovos-PHAL-plugin-homeassistant.home",
@@ -262,7 +263,7 @@ def init_configuration(self, message=None):
262263
self.bus.emit(
263264
Message("ovos.phal.plugin.homeassistant.requires.configuration"))
264265

265-
def build_devices(self):
266+
def build_devices(self, message: Optional[Message] = None):
266267
""" Build the devices from the Home Assistant API """
267268
for device in self.devices:
268269
device_type = map_entity_to_device_type(device["entity_id"])

ovos_PHAL_plugin_homeassistant/logic/integration.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
class Integrator:
77
# Class handles the integration of the plugin with the rest of the system
8-
8+
99
def __init__(self, bus, gui):
1010
""" Constructor
1111
Args:
@@ -15,11 +15,11 @@ def __init__(self, bus, gui):
1515
self.bus = bus
1616
self.gui = gui
1717
self.register_bus_listeners()
18-
18+
1919
def register_bus_listeners(self):
2020
self.bus.on('ovos.phal.plugin.homeassistant.integration.query_media',
2121
self.handle_query_media)
22-
22+
2323
def handle_query_media(self, message: Message):
2424
""" Handle a query to the media.
2525
Args:
@@ -44,7 +44,3 @@ def handle_query_media(self, message: Message):
4444
self.gui.send_event(
4545
"ovos.phal.plugin.homeassistant.integration.query_media.result",
4646
{"results": collected_results})
47-
48-
49-
50-

0 commit comments

Comments
 (0)