Automation with counter not triggering

I’ve been busy creating some automations for a roomba vacuum robot. Basically I want it to do 2 things:

  • When there’s nobody at home for at least 15 minutes, and there have been no cleaining run today: start cleaning.
  • If there was no cleaning run for 2 days, start cleaning at 16:00

To keep track when a cleaning run was last executed, I created a counter:

counter:
  days_since_clean:
    initial: 0
    step: 1

The counter gets incremented every day at midnight by this automation:

- alias: Reset cleaned today at midnight
  trigger:
    platform: time
    at: '00:00:00'
  action:
    service: counter.increment
    entity_id: counter.days_since_clean

Next, I created 2 automations that should trigger the robot to start cleaning:

- alias: vacuum when nobody home
  trigger:
    platform: state
    entity_id: group.personen
    to: 'not_home'
    for:
      minutes: 10
    condition:
    - condition: numeric_state
      entity_id: counter.days_since_clean
      above: 0
  action:
     - service: script.start_cleaning

and

- alias: start stofzuiger als dat 2 dagen niet gelukt is
  trigger:
    platform: time
    at: '16:00:00'
  condition:
  - condition: numeric_state
    entity_id: counter.days_since_clean
    above: 2
  action:
    - service: script.start_cleaning_after2days

And the 2 scripts that should be executed are:

start_cleaning:
  sequence:
- service: vacuum.turn_on
- service: notify.pushbullet
  data:
    message: "Nobody home, cleaning started"

and

start_cleaning_after2days:
  sequence:
    - service: vacuum.turn_on
    - service: notify.pushbullet
      data:
        message: "No cleaning for 2 days, starting now"

To reset the counter after a sucessfull cleaning, I have this automation

- alias: vacuum finished
  trigger:
  platform: state
  entity_id: sensor.roomba_status
to: 'End Mission'
  action:
    service: counter.reset
    entity_id: counter.days_since_clean

The problem is that the 2 automations to start the cleaning are never triggered, even though the group “personen” does get the status “not_home”. I’m guessing that the problem does have something to do with the counter, but I can’t figure out what I’m doing wrong.

Any ideas?

First add a few spaces in your automation so it is better readable

Looks like you changed the name off your script

formatting got kind of screwed up when I pasted the scripts and automations here, should be better now.

I’m by now pretty sure the problem with the automation is in the counter condition, I added this automation to see if the state change of group.personen would trigger a automation, which it does:

- alias: away test
  trigger:
    platform: state
    entity_id: group.personen
    to: 'not_home'
  action:
    service: notify.pushbullet
    data:
      message: "There's nobody home"

Erik

Is the condition quote miss placed?
It is under the for

  • alias: vacuum when nobody home
    trigger:
    platform: state
    entity_id: group.personen
    to: ‘not_home’
    for:
    minutes: 10
    condition:
    - condition: numeric_state
    entity_id: counter.days_since_clean
    above: 0

    action:

    • service: script.start_cleaning