Group state unknown?

hi,

i have a few motion detector sensors that change state between “detected” and “not_detected”. automations based on these states work fine.

if i group them into group.motion_detectors, the state for the group always reports as “unknown”

is there a way i can make the group state report “detected” if 1 or more motion sensors trigger? (or “not_detected” if none)

thanks

My grouped motion sensors are “on” if one is tripped and “off” if none are.

If you want to have an automation trigger for any motion sensor, you could just list them under entity_id. entity_id accepts lists:

entity_id:
  - thing.one
  - thing.two

or

entity_id: thing.one, thing.two

I’ve had a similar question as @creakyshrimp. I’ve been trying to come up with a way to take the state of a sensor and have an automation set the state of the group to match as well.

My use case is that I have a group named “Nest” for my Nest Thermostat that has a couple other sensors in it. I would like to have my “Nest” group’s state, receive the current value of the Nests HVAC sensor state. This would allow me to remove the HVAC sensor badge while still allowing access to its information in the front end by tapping on the group name.

defining the states as “on” and “off” works, and the motion sensor group reports correctly now.

to explain a little more fully, i have a couple motion sensors that natively report “on” and “off” and a couple that report integer alarm levels. before i had made a template sensor for each so that they all reported detected or not_detected, but if i simply make those on and off instead, then the group state behaves like desired

thanks much

@creakyshrimp Having them all say “on/off” as opposed to some saying “on” and some saying “detected” makes it so that it’s an oranges-to-oranges comparison. So the group understands what’s going on.

yes. but to be clear, i had created template sensors for all of the motion detectors that all reported detected or not_detected. the group state still invariably reported as “unknown” even though they were all consistent

simply changing “detected”/“not_detected” to “on”/“off” makes the group state report as intended.

it makes sense in retrospect. if i had a mixed group of “detected” and “not_detected” there’s no way hass could know which way the group state should be. but clearly in the hass code, if 1 or more group entities is “on”, the group is state is also defined as “on”. and if all are “off” then it’s “off”

2 Likes

Hi
I read this thread and was about to change to off/on instead of Home/Away. But, I found that it was simpler to define a value-template-sensor and then use that for automations. I now successfully combine ifttt-trigger when connect/disconnect to our google wifi (changes state of input_select for each person) and combine with KNX- and zigbee motion sensors throughout the house.

This will trigger off when no movement and all persons (phones) are away and on when there are movement somewhere or one of the phones are connected to google wifi. This is successfully used as a “house is empty”-automations in HA.

Maybe someone can have use of this example

  • platform: template
    sensors:
    nagon_hemma_automatisering:
    value_template: >-
    {{ is_state(‘input_select.carina_hemma’, ‘Hemma’)
    or is_state(‘input_select.ph_hemma’, ‘Hemma’)
    or is_state(‘input_select.oliver_hemma’, ‘Hemma’)
    or is_state(‘binary_sensor.oliverrum’, ‘on’)
    or is_state(‘binary_sensor.williamrum’, ‘on’)
    or is_state(‘binary_sensor.wc’, ‘on’)
    or is_state(‘binary_sensor.tvatt’, ‘on’)
    or is_state(‘binary_sensor.hall’, ‘on’)
    or is_state(‘binary_sensor.vardagsrum’, ‘on’)
    or is_state(‘binary_sensor.bad’, ‘on’)
    or is_state(‘binary_sensor.masterbad’, ‘on’) }}