Platform Time - Issues

Problems with automation below. It appears to never trigger. I’m using 0.78.0 on Docker instalation…

If I use any other trigger such as State it will work fine ( but I need Time ). What is my glaring mistake?

- id: weekday_morning_lights
  alias: Weekday Morning Lights
  hide_entity: false
  initial_state: true
  trigger:
    platform: time  
    at: '07:00:00'
  condition:
  - condition: state
    entity_id: script.weekday_morning_sequence
    state: 'off'
  action:
  - service: script.turn_on
    entity_id: script.weekday_morning_sequence
1 Like

Are you sure your host time (and time zone) are set correctly? I’ve heard that seems to be a common problem when time based automations don’t work as expected.

But otherwise the trigger looks OK. I think…

And just to check the obvious, are you mapping /etc/localtime from the host?

Yes, checked all docker-machine including localhost and all are synced

Sorry, yes to both questions above

The main problem is the trigger does not work

To add to what has already been said, this is usually caused by the time_zone setting in HA not agreeing with the time-zone setting in the environment in which HA is running, and/or the time being set incorrectly in the environment. If the time is set correctly, then make sure both HA and the environment are set to the same timezone.

1 Like

You all were absolutely right!!! THANKS!!!

I have to many paradigms issues - I didn’t see the trees or the pig…

I actually thought that the timezone problem was solved. However, I’m not sure. My automation based on “time” seem to be running correctly, but my history shows that the sun rises at 02:00 AM in the America/New_York TZ.

All other times in the history are correct

Please let me know if you see any errors below, I’m new at this

[ I have a few python3 programs running in seperate containers ]

My setup:

All containers except Home Assistant are using:

DockerFile:

  FROM alpine:latest
  
  COPY ./requirements.txt .
  
  ENV TZ='America/New_York'
  
  RUN apk add --update bash mosquitto mosquitto-clients && \
      apk add nano tzdata iputils && \
      apk add python3 && \
      pip3 install --upgrade pip && \
      pip3 install -r requirements.txt 

requirement.txt

datetime==4.2
simplejson==3.16.0
paho-mqtt==1.3.1
requests==2.18.4
virtualenv==15.1.0

HomeAssistant - docker-comose.yml

  homeassistant:
    container_name: hass
    image: homeassistant/home-assistant:latest
    ports:
      - "8123:8123"
    volumes:
      - /home/me/docker/hass/config:/config
      - /home/me/docker/hass/config/script_states:/script_states
      - /etc/localtime:/etc/localtime:ro
    restart: always
    network_mode: "host"
    depends_on:
      - mqtt
      - hue
      - sleep

All other contaimers using [ Includes - HomeAssistant - docker-comose.yml ]:

version: '3'
services:
  mqtt:
    build:
      context: ./mqtt
    image: mqtt:v0.2
    container_name: mqtt
    networks:
      home_net:
        ipv4_address: 172.50.0.3

  hue:
    build:
      context: ./hue
    image: hue:v0.2
    container_name: hue
    networks:
      home_net:
        ipv4_address: 172.50.0.9
    depends_on:
      - mqtt

  sleep:
    build:
      context: ./sleep
    image: sleep:v0.1
    container_name: sleep
    restart: unless-stopped
    volumes:
      - /home/me/docker/hass/config/script_states:/shar_hass
    networks:
      home_net:
        ipv4_address: 172.50.0.2
    depends_on:
      - mqtt
      - hue

  homeassistant:
    container_name: hass
    image: homeassistant/home-assistant:latest
    ports:
      - "8123:8123"
    volumes:
      - /home/me/docker/hass/config:/config
      - /home/me/docker/hass/config/script_states:/script_states
      - /etc/localtime:/etc/localtime:ro
    restart: always
    network_mode: "host"
    depends_on:
      - mqtt
      - hue
      - sleep

networks:
  home_net:
    external: true

How do you have your location set in HA configuration.yaml?

I do - America/New_York…

date gives me: Sun Sep 23 10:58:20 EDT 2018

49%20AM

From the container:

root@cont:/etc# cat timezone
Etc/UTC

Some how its not set to the TZ in the config…

Confusing!!

No, what I mean is what is the location set in your configuration.yaml?

Mine is like:

homeassistant:
  # Name of the location where Home Assistant is running
  name: NUC-docker
  # Location required to calculate the time the sun rises and sets
  latitude: 41.00000
  longitude: -85.0000
  # Impacts weather/sunrise data (altitude above sea level in meters)
  elevation: 866
  # 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/Indiana/Indianapolis

If those two items don’t match then there may be some inconsistency that confuses things.

Yes -

I think I just discovered the problem - its says so right there in the confuration.yaml :

Lat: 0
Long: 0

I missed it in the conversion from Hassio to Docker… I’ll change it and see if it fixes it… Stay Tuned!

Yeah, I wonder what the sunrise time is at the equator on the prime meridian is this time of year? I bet it’s 2 am or so our time. :wink: :laughing:

Good One!!! Probably different than where I live - Stupid, USA :joy:

I’ll have to wait till Sunset to checkit!!

THANKS!!!