Sun & Time triggers unresponsive (0.87.1)

Hey guys - I’m new to hass.io (0.87.1) and oddly enough I cannot get my automations to trigger. I have Lutron Caseta lights integrated that can be controled by the UI as well as the “Call Service” tab under developer tools. However, I cannot get the triggers to turn lights on or off.

At first I attempted to use a sunset trigger (which didn’t work). Then I moved to time triggers with the same result. Any idea what could be the cause? Issue with the internal clock?

Below is my config.yaml, automations.yaml, and system check.

Notes:

  • After several failed attempts I tried to adding platform: time and platform: time_date as sensors. The latter causes a failed config but the former has not. I can rerun the system check when I am home from work if that helps.
  • time 20:04:00 has been used with and without quotes
  • yaml files were verified with yamllint before use
  • xxx in config.yaml is redacted info (need to set up secrets)

Thanks for helping out a rookie. Feels silly that I cannot get the simplest automation to work.

config.yaml

homeassistant:
  # Name of the location where Home Assistant is running
  name: Home
  # Location required to calculate the time the sun rises and sets
  latitude: xxx
  longitude: xxx
  # Impacts weather/sunrise data (altitude above sea level in meters)
  elevation: 0
  # metric for Metric, imperial for Imperial
  unit_system: imperial
  # Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
  time_zone: America/New_York
  # Customization file
  customize: !include customize.yaml

# Show links to resources in log and frontend
introduction:

# Enables the frontend
frontend:

panel_iframe:
  configurator:
    title: Configurator
    icon: mdi:wrench
    url: http://192.168.1.202:3218

  nodered:
    title: 'Node-Red'
    icon: 'mdi:shuffle-variant'
    url: 'http://192.168.1.202:1880/'

# Enables configuration UI
config:

lutron_caseta:
  host: 192.168.1.18
  keyfile: /ssl/lutron/caseta.key
  certfile: /ssl/lutron/caseta.crt
  ca_certs: /ssl/lutron/caseta-bridge.crt
  
# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# http:
#   base_url: example.duckdns.org:8123

# Checks for available updates
# Note: This component will send some information about your system to
# the developers to assist with development of Home Assistant.
# For more information, please see:
# https://home-assistant.io/blog/2016/10/25/explaining-the-updater/
updater:
  # Optional, allows Home Assistant developers to focus on popular components.
  # include_used_components: true

# Discover some devices automatically
discovery:

# Allows you to issue voice commands from the frontend in enabled browsers
conversation:

# Enables support for tracking state changes over time
history:

# View all events in a logbook
logbook:

# Enables a map showing the location of tracked devices
map:

# Track the sun
sun:

# Allow diagnosing system problems
system_health:

# Sensors
sensor:
  # Weather prediction
  - platform: yr
  - platform: time_date

# Text to speech
tts:
  - platform: google

# Cloud
cloud:

# Notification
notify:
  - name: NOTIFIER_NAME
    platform: pushbullet
    api_key: xxx
  

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml

automations.yaml

- alias: 'Office Test'

  trigger:
    - platform: time_date
      at: 20:04:00

  action:
    - service: light.turn_off
      entity_id: light.office_main_lights

system check

login as: root
[email protected]'s password:

  _    _                 _
 | |  | |               (_)
 | |__| | __ _ ___ ___   _  ___
 |  __  |/ _` / __/ __| | |/ _ \
 | |  | | (_| \__ \__ \_| | (_) |
 |_|  |_|\__,_|___/___(_)_|\___/



Our Cli:
$ hassio help

debug1: permanently_set_uid: 0/0
core-ssh:~# hassio homeassistant check
Error: INFO:homeassistant.util.package:Attempting install of colorlog==4.0.2
Testing configuration at /config
Failed config
  automation:
    - Invalid config for [automation]: Invalid time specified: 68880 for dictionary value @ data['trigger'][0]['at']. Got None. (See /config/configuration.yaml, line 96). Please check the docs at https://home-assistant.io/components/automation/
    - cloud: ?
        mode: production
      config: ?
      conversation: ?
      discovery: ?
        enable: ?
        ignore: ?
      frontend: ?
        javascript_version: auto
      group: ?
      history: ?
        exclude: ?
        include: ?
        use_include_order: False
      introduction: ?
      logbook: ?
      lutron_caseta: [source /config/configuration.yaml:36]
        ca_certs: /ssl/lutron/caseta-bridge.crt
        certfile: /ssl/lutron/caseta.crt
        host: 192.168.1.18
        keyfile: /ssl/lutron/caseta.key
      map: ?
      panel_iframe: ?
        configurator: ?
          icon: mdi:wrench
          title: Configurator
          url: http://192.168.1.202:3218
        nodered: ?
          icon: mdi:shuffle-variant
          title: Node-Red
          url: http://192.168.1.202:1880/

For a time trigger you should use:

  trigger:
    - platform: time
      at: '20:04:00'

For a sunset trigger you should use something like:

  trigger:
    - platform: sun
      event: sunset

See Automation Trigger.

Unfortunately platform: time does not work (with or without quoting 20:04:00, I have seen configs with both), neither does platform: sun, event: sunset. Your link was my initial guide - I started attempting things like platform: time_date out of desperation (from ~20 failures) and viewing other configurations.

Then you must have something more basic wrong. Although, honestly, I don’t see what it might be.

Temporarily, in configuration.yaml, try changing:

automation: !include automations.yaml

to:

automation:
  - alias: 'Office Test'
    trigger:
      - platform: time
        at: '20:04:00'
    action:
      - service: light.turn_off
        entity_id: light.office_main_lights

Great idea - but the same result. This seems rather odd.

homeassistant:
  # Name of the location where Home Assistant is running
  name: Home
  # Location required to calculate the time the sun rises and sets
  latitude: xxx
  longitude: xxx
  # Impacts weather/sunrise data (altitude above sea level in meters)
  elevation: 0
  # metric for Metric, imperial for Imperial
  unit_system: imperial
  # Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
  time_zone: America/New_York
  # Customization file
  customize: !include customize.yaml

# Show links to resources in log and frontend
introduction:

# Enables the frontend
frontend:

panel_iframe:
  configurator:
    title: Configurator
    icon: mdi:wrench
    url: http://192.168.1.202:3218

  nodered:
    title: 'Node-Red'
    icon: 'mdi:shuffle-variant'
    url: 'http://192.168.1.202:1880/'

# Enables configuration UI
config:

lutron_caseta:
  host: 192.168.1.18
  keyfile: /ssl/lutron/caseta.key
  certfile: /ssl/lutron/caseta.crt
  ca_certs: /ssl/lutron/caseta-bridge.crt
  
# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# http:
#   base_url: example.duckdns.org:8123

# Checks for available updates
# Note: This component will send some information about your system to
# the developers to assist with development of Home Assistant.
# For more information, please see:
# https://home-assistant.io/blog/2016/10/25/explaining-the-updater/
updater:
  # Optional, allows Home Assistant developers to focus on popular components.
  # include_used_components: true

# Discover some devices automatically
discovery:

# Allows you to issue voice commands from the frontend in enabled browsers
conversation:

# Enables support for tracking state changes over time
history:

# View all events in a logbook
logbook:

# Enables a map showing the location of tracked devices
map:

# Track the sun
sun:

# Allow diagnosing system problems
system_health:

# Sensors
sensor:
  # Weather prediction
  - platform: yr
  - platform: time

# Text to speech
tts:
  - platform: google

# Cloud
cloud:

# Notification
notify:
  - name: NOTIFIER_NAME
    platform: pushbullet
    api_key: xxx
  

group: !include groups.yaml
automation:
  - alias: 'Office Test'
    trigger:
      - platform: time
        at: '13:36:00'
    action:
      - service: light.turn_off
        entity_id: light.office_main_lights
script: !include scripts.yaml

What is the exact error now with the automation in configuration.yaml?

Not sure which source I’m supposed to check for the error so here is all of them.

System Check

[email protected]'s password:

  _    _                 _
 | |  | |               (_)
 | |__| | __ _ ___ ___   _  ___
 |  __  |/ _` / __/ __| | |/ _ \
 | |  | | (_| \__ \__ \_| | (_) |
 |_|  |_|\__,_|___/___(_)_|\___/



Our Cli:
$ hassio help

debug1: permanently_set_uid: 0/0
core-ssh:~# hassio homeassistant check
Error: INFO:homeassistant.util.package:Attempting install of colorlog==4.0.2
Testing configuration at /config
Failed config
  General Errors:
    - Platform not found: sensor.time
Successful config (partial)

System Log

19-02-19 17:04:05 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-19 17:34:05 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-19 18:04:05 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-19 18:39:05 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-19 19:09:05 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-19 19:44:05 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-19 20:19:05 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-19 20:44:03 INFO (MainThread) [hassio.updater] Fetch update data from https://s3.amazonaws.com/hassio-version/stable.json
19-02-19 20:44:03 INFO (MainThread) [hassio.addons.git] Update add-on https://github.com/hassio-addons/repository repository
19-02-19 20:44:03 INFO (MainThread) [hassio.addons.git] Update add-on https://github.com/home-assistant/hassio-addons repository
19-02-19 20:44:05 INFO (MainThread) [hassio.addons] Load add-ons: 53 all - 0 new - 0 remove
19-02-19 20:49:05 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-19 21:24:05 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-19 21:59:05 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-19 22:29:06 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-19 22:59:06 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-19 23:01:52 INFO (MainThread) [hassio.api.proxy] /homeassistant/api/services access from core_configurator
19-02-19 23:01:52 INFO (MainThread) [hassio.api.proxy] /homeassistant/api/events access from core_configurator
19-02-19 23:01:52 INFO (MainThread) [hassio.api.proxy] /homeassistant/api/states access from core_configurator
19-02-19 23:29:06 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-19 23:59:06 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-20 00:29:06 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-20 00:59:06 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-20 01:29:06 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-20 01:59:06 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-20 02:05:29 INFO (MainThread) [hassio.api.proxy] /homeassistant/api/services access from core_configurator
19-02-20 02:05:29 INFO (MainThread) [hassio.api.proxy] /homeassistant/api/events access from core_configurator
19-02-20 02:05:29 INFO (MainThread) [hassio.api.proxy] /homeassistant/api/states access from core_configurator
19-02-20 02:29:06 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-20 02:44:03 INFO (MainThread) [hassio.updater] Fetch update data from https://s3.amazonaws.com/hassio-version/stable.json
19-02-20 02:44:03 INFO (MainThread) [hassio.addons.git] Update add-on https://github.com/home-assistant/hassio-addons repository
19-02-20 02:44:03 INFO (MainThread) [hassio.addons.git] Update add-on https://github.com/hassio-addons/repository repository
19-02-20 02:44:05 INFO (MainThread) [hassio.addons] Load add-ons: 53 all - 0 new - 0 remove
19-02-20 02:59:06 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-20 03:29:06 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-20 03:59:06 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-20 04:29:06 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-20 04:59:06 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-20 05:29:06 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-20 06:04:06 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-20 06:39:06 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-20 07:14:06 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-20 07:49:06 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-20 08:24:06 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-20 08:44:03 INFO (MainThread) [hassio.snapshots] Found 1 snapshot files
19-02-20 08:44:03 INFO (MainThread) [hassio.host.info] Update local host information
19-02-20 08:44:03 INFO (MainThread) [hassio.utils.gdbus] Call org.freedesktop.DBus.Properties.GetAll on /org/freedesktop/hostname1
19-02-20 08:44:03 INFO (MainThread) [hassio.updater] Fetch update data from https://s3.amazonaws.com/hassio-version/stable.json
19-02-20 08:44:03 INFO (MainThread) [hassio.addons.git] Update add-on https://github.com/home-assistant/hassio-addons repository
19-02-20 08:44:03 INFO (MainThread) [hassio.addons.git] Update add-on https://github.com/hassio-addons/repository repository
19-02-20 08:44:04 INFO (MainThread) [hassio.host.services] Update service information
19-02-20 08:44:04 INFO (MainThread) [hassio.utils.gdbus] Call org.freedesktop.systemd1.Manager.ListUnits on /org/freedesktop/systemd1
19-02-20 08:44:06 INFO (MainThread) [hassio.addons] Load add-ons: 53 all - 0 new - 0 remove
19-02-20 08:54:06 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-20 09:24:06 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-20 09:54:06 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-20 10:24:06 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-20 10:54:06 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-20 11:24:07 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-20 11:54:07 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-20 12:24:07 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-20 12:54:07 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-20 13:24:07 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-20 13:54:07 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-20 14:24:07 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-20 14:44:03 INFO (MainThread) [hassio.updater] Fetch update data from https://s3.amazonaws.com/hassio-version/stable.json
19-02-20 14:44:03 INFO (MainThread) [hassio.addons.git] Update add-on https://github.com/hassio-addons/repository repository
19-02-20 14:44:03 INFO (MainThread) [hassio.addons.git] Update add-on https://github.com/home-assistant/hassio-addons repository
19-02-20 14:44:06 INFO (MainThread) [hassio.addons] Load add-ons: 53 all - 0 new - 0 remove
19-02-20 14:54:07 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-20 15:24:07 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-20 15:54:07 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-20 16:24:07 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-20 16:54:07 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-20 17:29:07 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-20 18:04:07 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-20 18:29:40 INFO (MainThread) [hassio.api.proxy] /homeassistant/api/services access from core_configurator
19-02-20 18:29:40 INFO (MainThread) [hassio.api.proxy] /homeassistant/api/events access from core_configurator
19-02-20 18:29:40 INFO (MainThread) [hassio.api.proxy] /homeassistant/api/states access from core_configurator
19-02-20 18:39:07 INFO (MainThread) [hassio.homeassistant] Updated Home Assistant API token
19-02-20 18:57:56 INFO (MainThread) [hassio.api.security] /homeassistant/check access from core_ssh
19-02-20 18:57:56 INFO (SyncWorker_9) [hassio.docker] Run command 'python3 -m homeassistant -c /config --script check_config' on homeassistant/raspberrypi3-homeassistant

Log Viewer (via hassio.local:4277)

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/aiohttp/web_protocol.py", line 275, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
  File "aiohttp\_http_parser.pyx", line 523, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: invalid HTTP method

I think this is your problem (or at least one problem):

sensor:
  # Weather prediction
  - platform: yr
  - platform: time  <----

There is no such sensor platform named time.

Looks like I misunderstood your instructions. Although in the first example both the sensor and trigger were using platform: time_date.

Is the “time sensor” natively built into homeassistant or does it need to be explicitly added in the config?

There is a time trigger, and there is a time_date sensor. They are two different things.

Like all other types of triggers, the time trigger can just be used in an automation. You don’t have to “enable” it.

Like many sensors, the time_date sensor must be defined in your config for the corresponding sensor entity or entities to be created.

also, even more basic, have you checked in the dev-states page to see if the automation is “on”? if not it won’t ever run. If it isn’t “on” then you need to turn it to “on” by clicking the box to the left of the automation then turn on the toggle in the box that pops up.

If it was already “on” then…never mind…:slightly_smiling_face:

@finity thanks for the suggestion as I did not know you could turn off automatons from that page. That said, the automation was turned on - so this is not the cause. Learned something new though!

@pnbruckner I removed the sensor platform: time and reran my previous automation (below) and it still did not work. Oddly enough when I woke my pc, the office lights turned off. Very odd since hass.io is running on a rpi.

automation:
  - alias: 'Office Test'
    trigger:
      - platform: time
        at: '20:04:00'
    action:
      - service: light.turn_off
        entity_id: light.office_main_lights

I forgot to grab the logs so I will run it again tonight and post. Anything else I should test while I’m at it?

Enter the following into the Template Editor. Let me know what the output looks like.

{{ utcnow() }}
{{ now() }}
{{ utcnow().astimezone() }}
{{ now().astimezone() }}
{{ utcnow().tzinfo }}
{{ now().tzinfo }}
{{ now().astimezone().tzinfo }}

Also, you could try temporarily changing the time in the at parameter to, say, a value 10 minutes in the future and see if it works. :wink:

I usually give a 2-3 minute buffer from the current time (ex if it is 8:05 I set the trigger to 8:08), but not 10 mins. In theory the updates should be instantaneous as soon as the config is saved, correct?

I’m pretty sure you need to restart whenever you change your config for the changes to take effect.

This might be the simple missing piece. I have certainly tried restarting but with as many config edits as I have tried the two may have not lined up correctly. I will incorporate this tonight.

Do you also need a restart with edits to automations.yaml?

There may be limited scenarios in which you can change something and then use one of the “reload” buttons on the general config page, but I’ve long since given up on those. I always restart when changing anything (except now for ui-lovelace.yaml, which only requires a browser refresh.)

Also, can you try entering those templates into the Template Editor? The point of those is to determine if your clock and time zone settings are correct. Many people have been tripped up on those.

I will certainly try all the items above when I get home. Thanks for your assistance. Stay tuned!

I’ve never had any issues with any of the “reload…” buttons in the configuration page. It took me a while to figure out what “reload core” meant but once I figured it out I saw that it was working as well.

But anything else in the config you will need to restart, and if it’s a new/modified custom card for lovelace you will need to restart HA, refresh your lovelace page from the top right menu and clear the cache.