Timed trigger + conditions not working... Need help :(

Hi there !
I have a problem that I can’t manage to get around !
I want to setup my vacuum to start at 10:00 , but only when my wife and I are not at home.
I managed to setup device tracker, and to trigger the vacuum with time trigger + ONE device “not_home” condition.
As soon I add the second device, it doesn’t work anymore !?
Any clues ?
This is the script I have in automations.yaml :

- id: b1bff49a9cdc40f79e2d75ce1e7b1e12
  alias: Brigitte 10h
  trigger:
  - at: '10:00'
    platform: time
  condition:
  - condition: state
    entity_id: device_tracker.Ludovic
    state: not_home
  - condition: state
    entity_id: device_tracker.celine_tel
    state: not_home
  action:
  - data:
      entity_id: vacuum.brigitte
    service: vacuum.start

Thanks !

The template is using them as ‘and’. So both device_trackers need to be in the state ‘not_home’. Your format is correct accept for the fact that this device tracker has a capital in it: device_tracker.Ludovic. Remove the capital L. No entity_id’s should ever have capitals anywhere… ever.

Other than that, verify that the two device_trackers actually go to the state not_home. If they don’t you’ll have to change your script to handle that.

In general the automation looks good. Accept, when a device is not home the device_tracker’s state is not always ‘not_home’. It may be the name of a zone. Typically it’s better to do something like:

  condition:
    condition: template
    value_template: >
      {{ states('device_tracker.Ludovic') != 'home' and
         states('device_tracker.celine_tel') != 'home' }}

This may not be your problem, though. Check the spelling of the device_tracker’s, and as @petro says, entity_id’s should always be lower case. Look in known_devices.yaml, or just look on the States page to see the actual entity_id’s of your device_trackers.

1 Like

Thanks to both of you .
I’ll have a look at the second template, I find it easier to read, as I’m a programmer :wink:
The error was in facts due to the Capital Ludovic, I’ll correct this !

Thanks again !!!

1 Like