Add google_assistant alarm_control_panel#26249
Conversation
balloob
left a comment
There was a problem hiding this comment.
This is ok. It's a bit weird that we need to have the same code which means it won't work with multiple alarm control panels. However, that might just be fixed in the future if we allow specifying per-device alarm codes.
Please add tests and this is ok to merge.
| { | ||
| "level_synonym": [ | ||
| state.replace("_", " "), | ||
| state.split("_")[ |
There was a problem hiding this comment.
I wanted to generate the synonyms from the state name itself. so armed_away turns into armed away or away instead of hard coding it.
Do you recommend to keep it this way or just had code the synonyms?
| async def execute(self, command, data, params, challenge): | ||
| """Execute an ArmDisarm command.""" | ||
| if params["arm"] and not params.get("cancel"): | ||
| # _LOGGER.debug("%s - %s", self.state.state, params["armLevel"]) |
| { | ||
| "level_name": "triggered", | ||
| "level_values": [ | ||
| {"level_synonym": ["triggered", "triggered"], "lang": "en"} |
There was a problem hiding this comment.
The reason is this a duplicate is because for the Trigger state it is one word. and using the logic I did for the synonyms the result will be the same twice.
The alternative would be to hard code the synonym. what do you think?
There was a problem hiding this comment.
let's create the synonyms above this dict statement and add an if-check for triggered there.
|
One small comment needed, for the rest this looks great ! |
Description:
This PR adds the Alarm Control Panel devices to Google Assistant so that we can Arm and Disarm using google voice commands.
The Alarm Panel code needs to be the same as the
secure_devices_pinassigned for security devices. If thecode_arm_requiredis False then the system will arm without asking for the PIN otherwise it will ask for the PIN (which is the security CODE).I have tested this using the manual alarm control panel. This should work for the other alarm system integrations.
Pull request with documentation for home-assistant.io (if applicable): home-assistant/home-assistant.io#10250
Checklist:
tox. Your PR cannot be merged unless tests passIf user exposed functionality or configuration variables are added/changed: