Skip to content

Commit

Permalink
feat: rebuild device list (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejgray authored Jan 25, 2025
2 parents 54ae6b7 + b00a31d commit 884033c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
3 changes: 2 additions & 1 deletion ovos_PHAL_plugin_homeassistant/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def __init__(self, bus=None, config=None):
self.bus.on("ovos.phal.plugin.homeassistant.get.light.color", self.handle_get_light_color)
self.bus.on("ovos.phal.plugin.homeassistant.set.light.color", self.handle_set_light_color)
self.bus.on("ovos.phal.plugin.homeassistant.check_connected", self.handle_check_connected)
self.bus.on("ovos.phal.plugin.homeassistant.rebuild.device.list", self.build_devices)

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

def build_devices(self):
def build_devices(self, message: Optional[Message] = None):
""" Build the devices from the Home Assistant API """
for device in self.devices:
device_type = map_entity_to_device_type(device["entity_id"])
Expand Down
10 changes: 3 additions & 7 deletions ovos_PHAL_plugin_homeassistant/logic/integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

class Integrator:
# Class handles the integration of the plugin with the rest of the system

def __init__(self, bus, gui):
""" Constructor
Args:
Expand All @@ -15,11 +15,11 @@ def __init__(self, bus, gui):
self.bus = bus
self.gui = gui
self.register_bus_listeners()

def register_bus_listeners(self):
self.bus.on('ovos.phal.plugin.homeassistant.integration.query_media',
self.handle_query_media)

def handle_query_media(self, message: Message):
""" Handle a query to the media.
Args:
Expand All @@ -44,7 +44,3 @@ def handle_query_media(self, message: Message):
self.gui.send_event(
"ovos.phal.plugin.homeassistant.integration.query_media.result",
{"results": collected_results})




0 comments on commit 884033c

Please sign in to comment.