Help with automation- why it doesn't work

Please help me with this automation- why this is not working?
I’m trying to make an automation that when my computer is off for more then 2 minutes then turn off monitor power outlet.

- id: '1599715929990'
  alias: Turn off monitor when computer is off
  description: ''
  trigger:
  - entity_id: sensor.k3komp_online
    for: 'minutes: 2'
    from: 'true'
    platform: state
    to: 'false'
  condition: []
  action:
  - device_id: 169179bc26e14e13a5daaaff1e4a9333
    domain: switch
    entity_id: switch.greenwave_reality_inc_powernode_6_port_switch
    type: turn_off
  mode: single

Have a look here, your for: isn’t quite correct:

why withdrawn?

I tried how you wrote the for: section and it validated. You could try and do the official way and see if it works ?

I have changed it to “for: 00:02:00” and it works :slight_smile:
Funny thing is that official documentation here


says that i can use either this format
   # If given, will trigger when condition has been for X time, can also use days and milliseconds.
    for:
      hours: 1
      minutes: 10
      seconds: 5

or that

for: 00:02:00

but in my case the first one is not working…

Because you don’t have the same format. You put minutes: 2 in quotes but instead this should be on a new line intended without quotes, as in the example from the docs.

Will try- thx

- id: '1599715929990'
  alias: Turn off monitor when computer is off
  description: ''
  trigger:
  - entity_id: sensor.k3komp_online
    for: 
      minutes: 2
    from: 'true'
    platform: state
    to: 'false'
  condition: []
  action:
  - device_id: 169179bc26e14e13a5daaaff1e4a9333
    domain: switch
    entity_id: switch.greenwave_reality_inc_powernode_6_port_switch
    type: turn_off
  mode: single

however I feel that using '00:02:00' is nicer

1 Like

Mike ( :rofl: in joke ),
I would agree, it allows you to use exactly the same format all over your system and its easy to see where you change for hours:minutes:seconds

I don’t like to be forced to think very much before my 3rd cup of coffee

1 Like