Help with group state

hi all,
I have the following group. It usually is on “on” state. I need to set it to off when I arm my alarm (regardless of the state each binary sensor is). I can set it from developers tool (set action) but I don’t know which action to use in my automation. Can someone help?

The group acts as a binary sensor so I don’t think you can change the group state.

I thought so too, but how can I change it from developers mode then? :slight_smile:
if I change it here, I can see below in the developers tool that the is going from on to off

image

This just screams XY-problem.

If you need to resort to undocumented practices then you are doing something wrong.

1 Like

Yeah, you don’t change group states, the members of the group do.

Explain your actual problem, not how you are trying to solve it.

I have the following automation & group. I need to know which binary sensor fired the alarm. I think I could add each binary sensor to avoid the group but ideally I would like to use the group if it was possible.

- id: Attention alarm fired
  alias: Attention alarm fired
  trigger:
  - platform: state
    entity_id: group.group_alarm
    from: 'off'
    to: 'on'
#    for:
#      hours: 0
#      minutes: 10
#      seconds: 0
#      milliseconds: 0

  condition:
    not:
      - condition: state
        entity_id: alarm_control_panel.mqtt_alarm
        state: "disarmed"

  action: 
        - service: notify.mobile_app_makis_smartphone
          data_template:
            message: "The alarm fired by {{ expand('group.group_alarm') | selectattr('state', 'eq', 'on') | map(attribute='name') | list | join(', ') }} "
            data:
              color: '#2DF56D'
              vibrationPattern: "50" # The pattern you wish to set for vibrations
              ledColor: "blue"
              channel: Home Assistant without vibration channel # name of the channel you wish to create or utilize
              importance: high
              priority: high
              ttl: 0
group_alarm:
    name: Alarm Group
    entities: 
      - binary_sensor.1_main_door
      - binary_sensor.openclose_30 # τζαμι σαλονι
      - binary_sensor.openclose_18  # τζαμι κουζινα
      - binary_sensor.8_erker_tzami
      - binary_sensor.10_ypnodomatia_tzami
      - binary_sensor.13_mpanio_wc
      - binary_sensor.10009b4350_2 #αποθηκη
      - binary_sensor.openclose_53  # παντζουρι σαλονι
      - binary_sensor.9_erker_pantzouri
      - binary_sensor.11_ypnodomatia_pantzouri
      - binary_sensor.2_radar_outdoor
      - binary_sensor.3_radar_saloni
      - binary_sensor.4_radar_diadromos
      - binary_sensor.7_radar_mpalkoni
      - binary_sensor.12_ypnodomatia_radar

I can’t replicate the issue in developer tools.

Do you mean the group also is added to the list? You could add a replace to remove the group name from the list:

{{ (expand('group.doors_and_windows') | selectattr('state', 'eq', 'on') | map(attribute='name') | list | join(', ')) | replace("[Friendly name of group], ", "") }}

Sorry.
I can’t see your photos so I don’t understand exactly what you can’t replicate. The problem is that I need when I arm the alarm ideally the group to be ‘off’. Now in the summer I don’t close all the windows and covers, thus the group state is always on.

If all sensors of the group are off, the automation is working as is supposed to do

That is not the automation you posted.
I think you should look at some exclude filter on doors and windows that is open when you arm.
So something like, you arm the house.
An automation is triggered that either saves the currently open (or closed depending on how you want to set up the automation) doors in an input text as comma or space separated.
The alarm trigger has condition that compares the triggering entity against your list.

Something like that. But I would not try and use undocumented ways with my alarm. YMMV

1 Like