Fix configuration and example in template alarm_control_panel (#11931)

The configuration for template_alarm_control_panel currently doesn't work.  It is similar to the template sensor, and the proposed configuration works.
This commit is contained in:
MatthewFlamm 2020-01-31 09:15:51 -05:00 committed by Franck Nijhof
parent 9354932db2
commit 38176aef92
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3

View File

@ -31,58 +31,72 @@ To enable a Template Alarm Control Panel in your installation, add the following
# Example configuration.yaml entry # Example configuration.yaml entry
alarm_control_panel: alarm_control_panel:
- platform: template - platform: template
name: Safe Alarm Panel panels:
value_template: "{{ states('alarm_control_panel.real_alarm') }}" safe_alarm_panel:
arm_away: value_template: "{{ states('alarm_control_panel.real_alarm') }}"
service: alarm_control_panel.alarm_arm_away arm_away:
data: service: alarm_control_panel.alarm_arm_away
entity_id: alarm_control_panel.real_alarm data:
code: !secret alarm_code entity_id: alarm_control_panel.real_alarm
arm_home: code: !secret alarm_code
service: alarm_control_panel.alarm_arm_home arm_home:
data: service: alarm_control_panel.alarm_arm_home
entity_id: alarm_control_panel.real_alarm data:
code: !secret alarm_code entity_id: alarm_control_panel.real_alarm
disarm: code: !secret alarm_code
- condition: state disarm:
entity_id: device_tracker.paulus - condition: state
state: 'home' entity_id: device_tracker.paulus
- service: alarm_control_panel.alarm_arm_home state: 'home'
data: - service: alarm_control_panel.alarm_arm_home
entity_id: alarm_control_panel.real_alarm data:
code: !secret alarm_code entity_id: alarm_control_panel.real_alarm
code: !secret alarm_code
``` ```
{% endraw %} {% endraw %}
{% configuration %} {% configuration %}
name: panels:
description: Name to use in the frontend. description: List of your panels.
required: false required: true
type: string type: map
default: Template Alarm Control Panel keys:
value_template: alarm_control_panel_name:
description: "Defines a template to set the state of the alarm panel. Only the states `armed_away`, `armed_home`, `armed_night`, `disarmed`, `triggered` and `unavailable` are used." description: The slug of the panel.
required: false required: true
type: template type: map
disarm: keys:
description: Defines an action to run when the alarm is disarmed. name:
required: false description: Name to use in the frontend.
type: action required: false
arm_away: type: string
description: Defines an action to run when the alarm is armed to away mode. default: Template Alarm Control Panel
required: false value_template:
type: action description: "Defines a template to set the state of the alarm panel. Only the states `armed_away`, `armed_home`, `armed_night`, `disarmed`, `triggered` and `unavailable` are used."
arm_home: required: false
description: Defines an action to run when the alarm is armed to home mode. type: template
required: false disarm:
type: action description: Defines an action to run when the alarm is disarmed.
arm_night: required: false
description: Defines an action to run when the alarm is armed to night mode. type: action
required: false arm_away:
type: action description: Defines an action to run when the alarm is armed to away mode.
required: false
type: action
arm_home:
description: Defines an action to run when the alarm is armed to home mode.
required: false
type: action
arm_night:
description: Defines an action to run when the alarm is armed to night mode.
required: false
type: action
{% endconfiguration %} {% endconfiguration %}
## Considerations ## Considerations
If you are using the state of a integration that takes extra time to load, the Template Alarm Control Panel may get an `unknown` state during startup. This results in error messages in your log file until that integration has completed loading. If you use `is_state()` function in your template, you can avoid this situation. If you are using the state of a integration that takes extra time to load, the Template Alarm Control Panel may get an `unknown` state during startup. This results in error messages in your log file until that integration has completed loading. If you use `is_state()` function in your template, you can avoid this situation.