Why doesn't this automation work?

Hi all, I have the following set up:

configuration.yaml (snippet)

group: !include groups.yaml
automation: !include automations/automations.yaml

groups.yaml (snippet)

Adults:
   - sensor.julie
   - sensor.james   

automations.yaml

- id: heatingoffaway
  alias: 'Heating off away trigger'
  initial_state: true
  trigger:
    - platform: state
      entity_id: group.adults
      from: 'Home'
  condition:
    - condition: state
      entity_id: climate.thermostat
      state: heat
  action:
    - service: climate.set_temperature
      data:
        entity_id: climate.thermostat
        temperature: 40
        operation_mode: heat

This is what group.adults shows in the HA web interface:

Both of the devices report the location correctly i.e. street addresses and when they are in a pre-defined location “work”, etc, however as far as I can see the state of group.adult does not change from “unknown”. and therefore the automation doesn’t trigger.

Note: I’m using the custom GPS to street address component

The above snippet doesn’t look correct to me…

  adults:              <-------------- Group entity id
    name: Adults       <-------------- friendly name
    entities:          <-------------- entities
      - sensor.julie
      - sensor.james
1 Like

Thanks, I changed groups.yaml to what you suggested, however it’s still showing like the following

The group was fine how you had it, but the lower two lines need to be one space back (hyphen under the U in adults).

Home should have a lowercase h.

Heat needs quotes around it in both places.

1 Like

According to the doc’s entities is required :stuck_out_tongue: and you can’t have a capital A in the group entity id

Configuration variables:

view (Optional): If yes then the entry will be shown as a view (tab) at the top. Groups that are set to view: yes cannot be used as entities in other views.
name (Optional): Name of the group.
icon (Optional): If the group is a view, this icon will show at the top in the frontend instead of the name. If the group is a view and both name and icon have been specified, the icon will appear at the top of the frontend and the name will be displayed as the mouse-over text. If it’s not a view, then the icon shows when this group is used in another group.
control (Optional): Set value to hidden. If hidden then the group switch will be hidden.
entities (Required): array or comma delimited string, list of entities to group.

Did you restart or reload, reload I think doesn’t always seem to work, I always restart after changes?

Then the docs are wrong, it works fine, I have lots of groups like this in my setup.

You only need entities if you’re using the other configuration options for a group (like hidden, view or name), if you’re not using it as a front end card then these options are surplus to requirements and putting it as the OP did works perfectly.

See the groups in this package:

link removed

2 are groups of entities for backend purposes, the other two are cards on the interface.

ok, figured it out (I think) - it’s good that I learnt all that about formatting of yaml (I’ve changed my groups.yaml and automations.yaml now to reflect the correct spacing and quotes), but I think the problem was that I was using sensor.julie and sensor.james instead of device_tracker. The sensors are used for reporting the street address, but the device_tracker shows the home or not home state.

I will update when we leave the house next time!

1 Like

OK, it might work but it’s not consistent and very confusing for new people I think, for instance …

group:
Phone trackers: <---------- Uppercase and space and no entities:
- device_tracker.forthygpixel
- device_tracker.lauras_iphone
- device_tracker.courtney_iphone

Adults:
- device_tracker.forthygpixel
- device_tracker.lauras_iphone

occupancy_modes:
name: Occupancy
control: hidden
entities: <------- entites:
- group.phone_trackers <---------lowercase and underscore
- alarm_control_panel.alarm
- sensor.home_status
- input_boolean.guest_mode
- input_boolean.holiday_mode

Just makes yaml even more confusing, perhaps the docs need changing. I don’t know :stuck_out_tongue:

That’s the fun part, isn’t it? :stuck_out_tongue_winking_eye:

@rsachoc I think you are on the right lines with using device_tracker rather than sensor in your groups. It’s how I have it set up and it works. Sensor groups always show “unknown”.

1 Like