Stuck on conditions

I’ve been struggling to make this work.
The idea is simple. If, during the daytime, the remote hasn’t been pressed for thirty minutes, turn off the light. I’ve scripted the delay and turn off and it works.

This is what I’ve added to the automations.yaml file:

- id: "hue-lys autoav" # Skru av lyset  etter 30 minutters inaktivitet
  alias: "huelys av på dagtid"
  trigger:
    platform: state
    entity_id: sensor.huedimmer_updated
  condition:
    condition: and
    conditions:
      - condition: state
        entity_id: light.jakobs_rom
        state: 'on'
      - condition: time
        after: '08.00.00'
        before: '19.00.00'
  action:
    entity_id: jakob_lys_autoav
```
I get an invalid config error but I can't find anything useful in the logs and while I've been trawling the website to see what I've done wrong. 

Can anyone see where I messed up?
Thanks

Anything in the log?

What action are you taking? You are missing a service.

Also, I don’t recall if you can have before and after together. Try splitting them into two conditions.

The time format is wrong - it should be ‘08:00:00’

2 Likes

Thanks. Fixed that. Still not there.
I see now what is missing. The action is in a script that I wrote (and which is working), but I don’t have a call to start that script.
How do I do that?

I added you a working automation with single condition calling a script.

   - alias: "home night"
      hide_entity: True
      trigger:
        platform: state
        entity_id: group.all_devices
        from: 'not_home'
        to: 'home'
      condition:
        condition: state
        entity_id: sun.sun
        state: "below_horizon"
      action:
        - service: script.relaxed
1 Like

Also, I don’t recall if you can have before and after together. Try splitting them into two conditions.

I dunno, I got the info from here: Conditions - Home Assistant

condition:
  condition: time
  # At least one of the following is required.
  after: '15:00:00'
  before: '02:00:00'
  weekday:
    - mon
    - wed
    - fri
```
From what I understand, it should be possible?

That was the missing piece!
Thank you everyone.!