Automation issue with two booleans

This rule isn’t working as I expected. When it triggers (correctly), harley_just_outside is correctly set to ‘on’ but harley_outside is not set to ‘off’ (remains on). Any ideas?

- alias: Harley_inside
  trigger:
    platform: state
    entity_id: sensor.elk_zone_008
    from: 'Violated'
    to: 'Normal'
  condition:
    condition: state
    entity_id: input_boolean.harley_outside
    state: 'on'
  action:
  - service: input_boolean.turn_off
    data:
      entity_id: input_boolean.harley_outside
  - service: input_boolean.turn_on
    data:
      entity_id: input_boolean.harley_just_outside

The only thing I can think of, is double and triple check that you don’t have any other automations that are simultaneously changing the state of that boolean.

I do have this one which isn’t changing the value, but watching it - could that be it?

- alias: Harley_alarm
  trigger:
   platform: state
    entity_id: input_boolean.harley_outside
    from: 'off'
    to: 'on'
    for:
      minutes: 20
  action:
    - service: notify.fire_kitchen
      data:
        message: Harley may have been outside for twenty minutes, please verify.
    - service: notify.fire
      data:
        message: Harley may have been outside for twenty minutes, please verify.
    - service: notify.email
      data:
        title: 'Skynet Harley Warning'
        message: Harley may have been outside for twenty minutes, please verify.
    - service: input_boolean.turn_off
      data:
        entity_id: input_boolean.harley_outside

Yup, when I comment out that automation the first one works correctly. Any ideas how I can trigger something when input_boolean.harley_outside has been on for 20 minutes without breaking the first automation?

My guess would be the last line of the Harley_alarm automation. Its changing the state when it runs. Since your Harley_inside automation will always set the boolean state to off when you bring him in there is no need for the alarm one to do it, in fact since even with the alarm the dog could not get brought in I would say you don’t want it anyways

1 Like

That fixed it, thanks!

No problem!