Automation does not work here, because there is no possibility to enter code to disarm zones.
I can disarm an alarm control panel with a code, should be something like this:
action:
service: alarm_control_panel.alarm_disarm
entity_id: alalm_control_panel.alarm_1
data:
code: 1234
Yeah there is.
action:
- service: alarm_control_panel.alarm_disarm
data:
entity_id: alarm_control_panel.1
code: 1234
EDIT: too slow!
Guys, you are right, but this automation works only if you want to arm/disarm without ENTERING CODE. My idea is to make alarm_control_panel which can arm/disarm several zones.
No it doesn’t.
Trigger: Detect that one zone is disarmed (by the keypad or whatever), Action: disarm the others automatically.
In it’s simplest for it would look like this:
alias: all_alarms_off
trigger:
platform: state
entity_id:
- alarm_control_panel.1 # any one of these three going disarmed will trigger it
- alarm_control_panel.2
- alarm_control_panel.3
to: 'disarmed'
action:
- service: alarm_control_panel.alarm_disarm
data:
entity_id: alarm_control_panel.1
code: 1234
- service: alarm_control_panel.alarm_disarm
data:
entity_id: alarm_control_panel.2
code: 1234
- service: alarm_control_panel.alarm_disarm
data:
entity_id: alarm_control_panel.3
code: 1234
Now, the actions do have some issues. Say you disarm alarm 1, when alarm 2 and 3 are disarmed by the automation it will retrigger the automation. There is an easy and inelgant way around this:
Write this automation:
alias: all_alarms_off
trigger:
platform: state
entity_id:
- alarm_control_panel.1
- alarm_control_panel.2
- alarm_control_panel.3
to: 'disarmed'
action:
- service: script.all_alarms_off
And this script:
all_alarms_off:
sequence:
- service: homeassistant.turn_off # to prevent retriggering the automation
entity_id: automation.all_alarms_off
- service: alarm_control_panel.alarm_disarm
data:
entity_id: alarm_control_panel.1
code: 1234
- service: alarm_control_panel.alarm_disarm
data:
entity_id: alarm_control_panel.2
code: 1234
- service: alarm_control_panel.alarm_disarm
data:
entity_id: alarm_control_panel.3
code: 1234
- service: homeassistant.turn_on # don't forget to re-enable the automation
entity_id: automation.all_alarms_off
There are more complicated and elegant ways of selecting just the two alarms that didn’t trigger the automation using templates and selectattr()
. But I prefer offering something you can understand.
My project is:
I have made an entrance wall panel witch is running on raspberry pi 4 with 7” touchscreen in kiosk mode. I want to come home and to enter only one alarm_control_panel to disarm all zones. Now I should disarm each zone separately. I have a button for each alarm panel witch calls popup window with alarm_control_panel (it has a keypad, because I use touchscreen). So I want to make something like that, that can arm/disarm several zones at the same time.
See my edit above. It does what you want.
Thank’s I will try it now
This way is not good for me too. Now there is problem with popup card, ‘deviceID: this’ for popup card doesn’t work, card is opening on all devices!
This is my code for glance card with popup alarm_control_panel:
entities:
- entity: alarm_control_panel.perimetr_s_kodom
name: Периметр и гараж
styles:
card:
- animation: |
[[[
if (states['alarm_control_panel.perimetr_s_kodom'].state == 'pending') return 'blink 2s ease infinite';
else return 'null';
]]]
icon:
- color: |
[[[
if (states['alarm_control_panel.perimetr_s_kodom'].state == 'armed_away') return 'red';
if (states['alarm_control_panel.perimetr_s_kodom'].state == 'disarmed') return 'green';
else return 'orange';
]]]
tap_action:
action: call-service
service: browser_mod.popup
service_data:
card:
entity: alarm_control_panel.perimetr_s_kodom
name: Периметр и гараж
states:
- arm_away
type: alarm-panel
deviceID:
- this
large: false
title: Клавиатура
style: |
ha-card {
color: black;
font-size: 12px;
font-weight: bold;
}
.card-header {
font-size: 23px;
color: black;
text-align: center;
}
type: glance
I don’t know what you mean. Adding a script and an automation won’t change the way your front end works.
Wait, are you talking about something completely different now?
Did the automation and script work?
It works, but not the way I want. I have three zones and I want to arm/disarm them in different combinations. Separately, by two or all together. For example: to leave garage armed, and to disarm two rest zones. The idea of my project is that I have buttons on the screen, witch call popup card with alarm_panel. There is now any problem with arming zones, because I can use Template Alarm Control Panel (it doesn’t use code). To disarm without code I can use Template Alarm Control Panel too. But, I need to use CODE!!! for arming, and here I have problems … Template Alarm Control Panel doesn’t support code, if I use script for tap_action I have incorrect work of popup card and …
The appearance of my panel on raspberry pi in kiosk mode:
when I push glance card for one zone I have popup card like this:
So I want to have the same popup card to disarm several zones.
That is not what you asked for originally:
It helps to be very clear with your question. Otherwise you are just wasting your time and mine.
You are going to have to design a custom card to do what you want. You can’t do it with the existing alarm panel card. You could probably emulate it with the custom-button-card.
It is very good idea to make a custom alarm card, but I am far from doing it. That’s why I asked the question, may be somebody already solved this problem. It seems to me that it would be a very useful card.
Here is the solution without creating custom card. Thanks to @tom_l he gave mi the way to go. May be someone will use it.
Alarm panels I use:
- platform: mqtt
name: "Main Panel"
state_topic: 'manual/perimetr_garagh/alarm'
command_topic: 'alarm/perimetr/garazh' # this is a fake command_topic to use it with automations
payload_disarm: 'disarm'
payload_arm_away: 'arm'
code: 12345
code_arm_required: false
code_disarm_required: true
- platform: manual_mqtt
name: "Manual Perimetr Garagh"
state_topic: 'manual/perimetr_garagh/alarm'
command_topic: 'manual/perimetr_garagh/alarm'
armed_away:
pending_time: 0
delay_time: 0
- platform: manual_mqtt
name: "Manual Test1"
state_topic: 'manual/test1/alarm'
command_topic: 'manual/test1/alarm/set'
armed_away:
pending_time: 0
delay_time: 0
- platform: manual_mqtt
name: "Manual Test2"
state_topic: 'manual/test2/alarm'
command_topic: 'manual/test2/alarm/set'
armed_away:
pending_time: 0
delay_time: 0
alarm_control_panel.manual_perimetr_garagh is created to use it’s state_topic for alarm_control_panel.main_panel
Automations I use:
- alias: 'alarm_perimetr_garazh_arm'
initial_state: 'on'
trigger:
platform: mqtt
topic: alarm/perimetr/garazh
payload: 'arm'
action:
- service: alarm_control_panel.alarm_arm_away
data:
entity_id: alarm_control_panel.manual_test1
- service: alarm_control_panel.alarm_arm_away
data:
entity_id: alarm_control_panel.manual_test2
- alias: 'alarm_perimetr_garazh_disarm'
initial_state: 'on'
trigger:
platform: mqtt
topic: alarm/perimetr/garazh
payload: 'disarm'
action:
- service: alarm_control_panel.alarm_disarm
data:
entity_id: alarm_control_panel.manual_test1
- service: alarm_control_panel.alarm_disarm
data:
entity_id: alarm_control_panel.manual_test2
- alias: 'alarm_alarm_perimetr_garagh_state1'
initial_state: 'on'
trigger:
platform: homeassistant
event: start
condition:
condition: or
conditions:
- condition: state
entity_id: alarm_control_panel.manual_test1
state: 'armed_away'
- condition: state
entity_id: alarm_control_panel.manual_test2
state: 'armed_away'
action:
- service: alarm_control_panel.alarm_arm_away
data:
entity_id: alarm_control_panel.manual_perimetr_garagh
- alias: 'alarm_alarm_perimetr_garagh_state2'
initial_state: 'on'
trigger:
platform: homeassistant
event: start
condition:
condition: and
conditions:
- condition: state
entity_id: alarm_control_panel.manual_test1
state: 'disarmed'
- condition: state
entity_id: alarm_control_panel.manual_test2
state: 'disarmed'
action:
- service: alarm_control_panel.alarm_disarm
data:
entity_id: alarm_control_panel.manual_perimetr_garagh
- alias: 'alarm_alarm_perimetr_garagh_state3'
initial_state: 'on'
trigger:
platform: state
entity_id:
- alarm_control_panel.manual_test1
- alarm_control_panel.manual_test2
to: 'armed_away'
action:
- service: alarm_control_panel.alarm_arm_away
data:
entity_id: alarm_control_panel.manual_perimetr_garagh
- alias: 'alarm_alarm_perimetr_garagh_state4'
initial_state: 'on'
trigger:
platform: state
entity_id:
- alarm_control_panel.manual_test1
- alarm_control_panel.manual_test2
to: 'disarmed'
condition:
condition: and
conditions:
- condition: state
entity_id: alarm_control_panel.manual_test1
state: 'disarmed'
- condition: state
entity_id: alarm_control_panel.manual_test2
state: 'disarmed'
action:
- service: alarm_control_panel.alarm_disarm
data:
entity_id: alarm_control_panel.manual_perimetr_garagh
couldn’t you use this?
No, it doesn’t work with popup windows.
i have two seperate alarms i want to arm and disarm at the same time. alarm_control_panel.ha_alarm will be my control alarm which is the one i will arm and disarm from. alarm_control_panel.home would be the controlled alarm that arms and disarms when the other one does. i use a code for the control alarm to disarm but otherwise no code is needed as the code is only entered on the front end on my tablet. the rest is not accessable unless you can somehow get to my computer before the alarm goes off… not happening. is there an easy way to tie the two together to have them arm and disarm together?