Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95925

Automation triggering reliability issues and triggering the wrong automation

$
0
0

@ossy-ha wrote:

Hello folks - seasons greetings!

I am having the most trouble getting some automations set up for my Zwave immersion heater controller (Horstmann SIR321). To all instents and purposes, it is a relay/switch so the only thing that can be done with its entity is Turn on/Turn off.

Background

I have most of the basic building blocks working but there are some niggles that I am struggling to debug. Most of what is working has been copy and pasted from the cookbook/the forum.

My primary goals for the water heater and HA are as follows:

  • Have a button in Lovelace which when pressed puts the water heater on for 1 hour
  • Trigger the water heater to come on for one hour at a different time each day of the week (also from Lovelace)

This screenshot shows what the front end looks like:

The code for the cards looks like this:

- badges: []
    cards:
      - entities:
          - switch.horstmann_secure_meters_sir321_rf_countdown_timer_switch
        show_header_toggle: false
        title: Immersion Heater Status
        type: entities
      - entity: automation.hot_water_on_one_hour
        hold_action:
          action: none
        icon: 'mdi:thermometer-lines'
        name: Boost hot water for 1 hour
        show_icon: true
        show_name: true
        tap_action:
          action: call-service
          service: automation.trigger
        type: entity-button
      - entities:
          - entity: input_datetime.hws_mo
          - entity: input_datetime.hws_tu
          - entity: input_datetime.hws_we
          - entity: input_datetime.hws_th
          - entity: input_datetime.hws_fr
          - entity: input_datetime.hws_sa
          - entity: input_datetime.hws_su
        show_header_toggle: false
        title: Water heater schedule
        type: entities
    path: hot-water
    title: Hot Water

At the back end I have the following automations:

  • Hot Water On - One Hour
    Turns the heater on
    [Send a notification to my phone for debugging]
    Delays for an hour
    Turns it off
  • Hot water - Monday
    Use a template, a time sensor and input entitiy to evaluate the current time
    Check a condition to see if it is the right day of the week
    Trigger the Hot Water On - One Hour automation
    [Send a notification to my phone for debugging]

Once this is working, it is my intention to have further automations which cover the other days of the week

Automations.yaml looks like this:

- id: '1571092941517'
  alias: Hot Water On - One Hour
  description: Switches the water on for 1 hour at any time
  trigger: []
  condition: []
  action:
  - device_id: 75fb2ec189524b3c81012dde9cbe066c
    domain: switch
    entity_id: switch.horstmann_secure_meters_sir321_rf_countdown_timer_switch
    type: turn_on
  - data:
      message: automation triggered  - Hot Water On - One Hour
    service: notify.notify
  - delay: 01:00:00
  - device_id: 75fb2ec189524b3c81012dde9cbe066c
    domain: switch
    entity_id: switch.horstmann_secure_meters_sir321_rf_countdown_timer_switch
    type: turn_off
- id: '1577119893046'
  alias: 'DEBUG: Hot water switch on'
  description: ''
  trigger:
  - device_id: 75fb2ec189524b3c81012dde9cbe066c
    domain: switch
    entity_id: switch.horstmann_secure_meters_sir321_rf_countdown_timer_switch
    platform: device
    type: turned_on
  condition: []
  action:
  - data:
      message: water heater on
    service: system_log.write
- id: '1577120792510'
  alias: 'DEBUG: Hot water switch off'
  description: ''
  trigger:
  - device_id: 75fb2ec189524b3c81012dde9cbe066c
    domain: switch
    entity_id: switch.horstmann_secure_meters_sir321_rf_countdown_timer_switch
    platform: device
    type: turned_off
  condition: []
  action:
  - data:
      message: water heater off
    service: system_log.write
- id: '1577124991290'
  alias: Hot water - Monday
  description: Monday day condition is in config.yaml you can't see it here
  trigger:
  - platform: template
    value_template: '{{ states(''sensor.time'') == (states.input_datetime.hws_mo.attributes.tim>
      | int | timestamp_custom(''%H:%M'', False)) }}'
  condition:
  - after: 00:00:01
    before: '23:59:59'
    condition: time
    weekday:
    - mon
  action:
  - data:
      entity_id: automation.hot_water_on_one_hour
    service: automation.trigger
  - data:
      message: Monday automation triggered
    service: notify.notify

For debugging I have two extra automations that write to the log what the switch is doing.

All automations have been tested in isolation, if they are triggered by clicking the ‘Trigger’ button in the (i) card for each automation they work properly:

For reference this is my configurations.yaml file:

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

# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# http:
#   base_url: example.duckdns.org:8123

# Discover some devices automatically
discovery:

# Sensors
sensor:
  - platform: time_date
    display_options:
      - 'time'
      - 'date'
      - 'date_time'
      - 'time_date'
      - 'time_utc'
      - 'beat'
  # Weather prediction
  - platform: yr


# Text to speech
tts:
  - platform: google_translate

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

#Entity Variables

#Hot water timer inputs
input_datetime:
  hws_mo:
    name: Set time for water heater (Monday)
    has_date: false
    has_time: true

  hws_tu:
    name: Set time for water heater (Tuesday)
    has_date: false
    has_time: true

  hws_we:
    name: Set time for water heater (Wednesday)
    has_date: false
    has_time: true

  hws_th:
    name: Set time for water heater (Thursday)
    has_date: false
    has_time: true

  hws_fr:
    name: Set time for water heater (Friday)
    has_date: false
    has_time: true

  hws_sa:
    name: Set time for water heater (Saturday)
    has_date: false
    has_time: true

  hws_su:
    name: Set time for water heater (Sunday)
    has_date: false
    has_time: true


  • Hot Water On - One Hour - expected behaviour: water switch goes on, notification arrives to phone, water goes off after one hour
  • Hot water - Monday - expected behaviour: water switch goes on, notification arrives to phone, water switch goes on, second notification arrives to phone from nested automation trigger, water goes off after time delay

I am aware that triggering in this way ignores conditions. The time based automation has also been tested and fires at the right time if the day is correct.

For reference I am running HA inside a docker container. Docker is running on Unbuntu 18 on an NUC, I got it up and running using this tutorial: Absolute Beginners guide to installing HA on Intel NUC using Docker and since then have added samba and git to the docker container where HA runs. I’m not sure if further details are relevant, please let me know if they might be useful.

The system is running Home Assistant 0.100.1
Frontend version: 20191002.2 - latest

System Health

arch x86_64
dev false
docker true
hassio false
os_name Linux
python_version 3.7.4
timezone Europe/London
version 0.100.1
virtualenv false

Lovelace

mode storage
resources 0
views 3

Issues

In practice, however, things are not so good. I currently have the following issues with my set up:

  • When pressing the ‘Boost hot water for 1 hour’ button in lovelace behaviour is inconsistent.
    —Pressing the button causes the ‘Monday’ automation to fire, a ‘Monday’ notification arrives to my phone
    ------It would seem that the button is mapped to the wrong trigger but it isn’t
    —Sometimes, the water switch does toggle over and sometimes it doesn’t
    —When the switch does activate from this button press, three notifications arrive to my phone, one for ‘Monday’ and two for ‘one hour boost’ (I presume this is one from the actual entity call and one from the nested call inside the monday automation).

  • When the ‘Monday’ automation is triggered by the correct date and time, sometimes it calls the ‘one hour boost’ automation trigger and sometimes it doesn’t.

Three notifications from one button press:

More simply:

  • The entity card in lovelace seems to be calling the wrong automation
  • The time based automation intermittently doesn’t call the 1 hour automation in its action

All of which results in some early morning cold showers that are pretty unpleasant!

Questions

All this in mind, I would really appreciate some pointers on the following things:

  • Is there something wrong with my set up that I have missed?
  • What might be causing the intermittent behaviour of automation making them unreliable?
  • How do you go about debugging something like this, the logs and so on have no shown me anything that I can use to progress
  • Would it be better to just have on-delay-off actions in each of my day-of-the-week automation, instead of calling another automation trigger (this feels like duplicating code but maybe that’s ok in this instance)

Any tips much appreciated!
Many thanks and warm regards,
D

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 95925

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>