Background
I’ve got an NSPanel near my front door that I want to use to control my alarm. My intended use is as follows:
- Enter the alarm in the NSPanel
- When one of the button is pressed on the right (e.g. Arm Night), a text sensor in Home Assistant is updated with the following contents:
{"page": "pageAlarm", "component": "arm_night", "action": "release", "value": 1111}
- The update of the
sensor.nspanel_event
will trigger an automation - In the automation I store the contents of the sensor in a variable:
variables:
event_json: '{{ states( ''sensor.nspanel_event'' )|from_json }}'
- Then I will do a service call:
service: alarm_control_panel.alarm_arm_night
data:
code: '{{ event_json.value }}'
target:
entity_id: alarm_control_panel.ha_alarm
- After this call I want the NSPanel to make a sound on whether the code was correct or not. (nice ‘pling’ sound if correct, and a low ‘bahhh’ sound if incorrect). In the automation there is no good way of knowing whether the code was entered correct or not.
If you call the service in the developer tools with the wrong code you get an error:
Ideally I’d like to have access to this error within the automation.
Feature request
Add a possibility to use the results (failed/success) of a service call in an automation. Maybe similar to this: amitfin/retry: Home Assistant Integration with Retry Service (github.com)
service: alarm_control_panel.alarm_arm_night
data:
code: '{{ event_json.value }}'
target:
entity_id: alarm_control_panel.ha_alarm
on_error:
service: script.make_error_sound
on_success:
service: script.make_success_sound