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

fix: add handler for rebuilding device list intent #52

Merged
merged 5 commits into from
Jan 29, 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
11 changes: 11 additions & 0 deletions neon_homeassistant_skill/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,17 @@ def disable_ha_intents(self):
self._intents_enabled = False

# Handlers

@intent_handler("get.all.devices.intent") # pragma: no cover
def handle_rebuild_device_list(self, message: Message):
self.bus.emit(
message.forward(
"ovos.phal.plugin.homeassistant.rebuild.device.list",
None,
)
)
self.speak_dialog("acknowledge")

@intent_handler("enable.intent") # pragma: no cover
def handle_enable_intent(self, message: Message):
self.settings["disable_intents"] = False
Expand Down
2 changes: 1 addition & 1 deletion neon_homeassistant_skill/locale/en-us/skill.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
"skill",
"plugin"
],
"version": "0.0.23"
"version": "0.0.24"
}
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "neon-homeassistant-skill"
version = "0.0.23"
version = "0.0.24"
description = "An OVOS/Neon.AI Skill for Home Assistant, which integrates with ovos-PHAL-plugin-homeassistant."
authors = ["Mike Gray <[email protected]>"]
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion skill.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
"skill",
"plugin"
],
"version": "0.0.23"
"version": "0.0.24"
}
2 changes: 2 additions & 0 deletions test/test_intents.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1484,6 +1484,8 @@ en-us:
disable.intent:
- Disable Home Assistant
- I don't use Home Assistant
get.all.devices.intent:
- rebuild device list
unmatched intents:
en-us:
- set a reminder to change my oil at 4 PM
Expand Down
1 change: 1 addition & 0 deletions test/test_resources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@ intents:
- assist.intent
- disable.intent
- enable.intent
- get.all.devices.intent
# Adapt intents are the name passed to the constructor
adapt: []
5 changes: 5 additions & 0 deletions test/test_skill.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,8 @@ def test_set_light_color_response_silent_entities(self):
self.skill.speak_dialog.assert_has_calls(
[call("lights.current.color", data={"device": "bunny", "color": "mauve"})]
)

def test_get_all_devices(self):
self.skill.speak_dialog = Mock()
self.skill.handle_rebuild_device_list(Message(msg_type="test"))
self.skill.speak_dialog.assert_called_once_with("acknowledge")
Loading