Automation triggers even though time condition should prevent it

I need another pair of eyes on this automation.

I have a weird issue, where my Samsung tv will automatically turn on and off again once every night, usually around 12:30 am.
Unfortunately, I have an automation that gets triggered by the TV.

The simplest solution was to add a time condition to my automation. However the automation still gets triggered every night.

Is there an error in the config?

id: chillout_when_tv_on
alias: Chilloutmodus aktivieren wenn abends TV an
trigger:
  platform: state
  entity_id: media_player.fernseher
  to: "on"
condition:
  - condition: time
    after: "19:30:00"
    before: "23:00:00"
action:
  - service: script.chilloutmodus

Thanks for your help

Lukas

I take it the script works fine inside those hours ? What system are you running, as I’m Ubuntu box didn’t ‘spring’ forward this year. I didn’t notice till one late night, and was most confused that it was before my bedtime, but I’d been asleep…

The cause for your Tv turning on without interaction is probably the automatic search for firmware updates.

The reason for the condition not working is probably that you are providing a (single item) list of conditions, whereas the documentation does only allow this nested below „or“ and „and“ condition. Try this:

condition:
  condition: time
  after: "19:30:00"
  before: "23:00:00"

Also, check time and timezone, especially when running HA inside a Docker container.

I am running Home Assistant (hass.io) on a RPi3. The time seems to be correct, judging by the timestamps in the log files. Not sure where else I could check the system time.

I will try changing the condition entry to a single item. There are however examples in the documentation for lists of conditions:

This can’t be issue, HA doesn’t care whether you provide a single item or a list containing only one item

1 Like

so script.chillmodus starts even though the time is outside 19:30 - 23:00?

Can you please try ro use this as an action and check if it shows the correct time?

action:
  service: persisent_notification.create
  data_template:
    message: "Die aktuelle Zeit ist: {{ now() }}"
2 Likes

Well, that is interesting :slight_smile:

image

Thank you very much!
A couple of weeks ago I switched the main configuration from yaml to the UI, that is probably where the issue occured.

It’s never DNS, it can’t be DNS…
it’s DNS…