Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: rebuild device list #63

Merged
merged 1 commit into from
Jan 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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})




Loading