"Group" not_home never true

Hi.
After the latest update, the entity group is no more available or usable as a condition.
I have an automation that I want triggered at a certain time, but only if I am not_home

I have tried

  - condition: template
    value_template: 'value_template: "{{ not is_state(''device_tracker.google_maps_******'',
      ''home'') }}"'
  - condition: template
    value_template: 'value_template: "{{ not is_state(''device_tracker.google_maps_****',
      ''home'') }}"'

and

  condition:
  - condition: state
    entity_id: device_tracker.google_maps_******
    state: not_home
  - condition: state
    entity_id: device_tracker.google_maps_*****
    state: not_home

The devices are in all the states, showed the right zone, but even when we are both not_home none of the above condition is EVER true and the automation never triggered.

Where am I wrong? the deprecated device group was working.

Thanks in advance.

I can see no groups in your code, where are they?

Could you elaborate?

  - condition: template
    value_template: 'value_template: "{{ not is_state(''device_tracker.google_maps_******'',
      ''home'') }}"'

This will never work, look what you put inside quotes.

thank you for your answer.
nope, I expurged group.all_devices once it was deprecated.
Before the breaking release it was a legal part of a condition, after the update the condition was everytime false.

the second part: sorry for the copy/paste error. the same, once purged it wasn’t working.

Why not simply create the group manually?

all_devices:
  entities:
    - device_tracker.google_maps_****1
    - device_tracker.google_maps_****2

if anything, you should brush-up your jinja templates:

  - condition: template
    value_template: >
       {{ not is_state('device_tracker.google_maps_****', 'home') }}

or

  - condition: template
    value_template: >
      {{ states('device_tracker.google_maps_****') != 'home' }}

ie, stop using double single quotes, dont write double value_template, and to make things easier (not perse required but easier) use multi-line notation with the > to prevent mistakes with inner and outer quotes

if you take @VDRainer 's advice, which is very sane, you can use the same template for the group.all_devices (but do understand what you want, and maybe use the all: true option to explicitly state all group members need to be ‘home’ for the group to be ‘home’)

Thank you all.
I’ll study your answers -english is not my first language-
I’ll clean the template for good
and will try creating the group

thank you all for now :slight_smile:

Aaand… it works.
just the double quotes.
I really don’t know better :confused:
Thank you all :slight_smile:

Just to say I’m also having trouble with an automation which uses a group as its trigger. I was trying to use this

  - alias: 'Turn on occupancy simulation'
    trigger:
      - platform: state
        entity_id: group.parents
        to: "Not_home"
        for:
          hours: 2

but found it didn’t trigger. When I go to ‘history’ and look at the history for that group, it’s blank until we get home. Which is odd?

always check (the group.parents) state in the states page. ‘Not_home’ is no valid state…

‘not_home’ might work :wink:

I tried to check the state in the states page but because both parents were at home, it didn’t show me the opposite state. I tried to look in the history as I mentioned above, but for the period during which both parents were not at home is blank, as I mentioned. Odd.
Thank you for the tip, I’ll try to adjust the quotation marks and the capitalisation as you suggest.

Fyi, you can set the state of one of the group members and that will change the group state accordingly .

Quotes are both ok, no need to change that, only capitalization.

I have an impression that group’s state has meaning only when the group contains entities of some binary logic i.e input_booleans, switches etc. The easiest way to see a group’s state is to find it in States as it’s an entity.
tl;dr - It might be that a group of entities that have home/not_home status never has state == True.

well yes, mixed groups wont have state home/not_home.

In this case OP uses device_trackers, which will make the group have the state home/not_home also.

I was saying that he can test the state of the group, but setting the state of the individual device_trackers in the developer/state page.

Note that the option all: can be useful in this case. This would set the group to home, only if all group members are home. Without that, the group would be only not_home if all members are not_home …

My point was different. For example, I have a group of temperature sensors - its state is unknown, but it’s not a mixed group.
If device_trackers are in a way binary then it might work, but I wouldn’t count on it without checking. I believe it’s easy just to make sure it will ever work :wink:

yes, you are right. not all non-mixed groups have a group state not being ‘unknown’.

and yes, always check in the states page what state an entity, being a group or a single entity, has.