Core: Automations triggers twice

Created on 11 Jan 2019  路  14Comments  路  Source: home-assistant/core

Home Assistant release with the issue:
0.85

Last working Home Assistant release (if known):
Not sure, 0.84.X?

Operating environment (Hass.io/Docker/Windows/etc.):
Windows 10, Python 3.6.8 64-bit

Component/platform:
automation

Description of problem:
All automations are triggering twice. Below are two examples. One is triggered at Home assistant start, the other is triggered by platform time.

Problem-relevant configuration.yaml entries:

- alias: V盲rmepump - Automatisk v盲rmejustering
  trigger:
    platform: time
    minutes: 0
    seconds: 00
  action ...


- alias: Autorun
  trigger:
    platform: homeassistant
    event: start
  action: ...

Traceback (if applicable):

Additional information:

automation logbook

Most helpful comment

I have exactly the same problem but: for me they show as triggered in the logbook (twice) but nothing actually does trigger.

All 14 comments

2
1

I noticed this too after updating from 0.84.6 to 0.85.0 yesterday. I've checked the database (events table) and it's only logged once. It is listed twice (with the exact same time, but different context_id) in the API response if you request the logbook from web browser though. Not sure what's happening here, but it seems to not actually trigger twice, just shown twice.

EDIT: this happens for all my automations, not just at startup or something.

I noticed this too after updating from 0.84.6 to 0.85.0 yesterday. I've checked the database (events table) and it's only logged once. It is listed twice (with the exact same time, but different context_id) in the API response if you request the logbook from web browser though. Not sure what's happening here, but it seems to not actually trigger twice, just shown twice.

EDIT: this happens for all my automations, not just at startup or something.

You are right. All my automations is indeed triggered twice. At least they are shown twice in the logbook.

I have exactly the same problem but: for me they show as triggered in the logbook (twice) but nothing actually does trigger.

Glad I'm not alone. I was in the middle of a massive overhaul of my automation layout and assumed I caused this. I've been trying to figure this out for two days before finally coming here!

Mine is running in a Linux virtual environment.

configuration.yaml:

automation: !include_dir_merge_list includes/automations

Directory contents:

(homeassistant) homeassistant@automation:~/.homeassistant$ ls -la includes/automations/
total 120
drwxr-xr-x 2 homeassistant homeassistant  4096 Jan 13 13:42 .
drwxr-xr-x 3 homeassistant homeassistant  4096 Jan 13 13:30 ..
-rw-r--r-- 1 homeassistant homeassistant   220 Jan 12 16:03 000_alexa_automations.yaml
-rw-r--r-- 1 homeassistant homeassistant  2982 Jan 12 16:03 010_security_system.yaml
-rw-r--r-- 1 homeassistant homeassistant  7056 Jan 12 16:03 020_door_locks.yaml
-rw-r--r-- 1 homeassistant homeassistant  3622 Jan 13 13:25 030_exterior_door_sensors.yaml
-rw-r--r-- 1 homeassistant homeassistant  2812 Jan 12 16:24 040_interior_door_sensors.yaml
-rw-r--r-- 1 homeassistant homeassistant  5351 Jan 12 16:27 050_location_based.yaml
-rw-r--r-- 1 homeassistant homeassistant  5959 Jan 13 13:29 060_motion_sensors.yaml
-rw-r--r-- 1 homeassistant homeassistant  2422 Jan 13 13:30 070_family_room_receiver.yaml
-rw-r--r-- 1 homeassistant homeassistant   711 Jan 12 20:10 080_good_evening.yaml
-rw-r--r-- 1 homeassistant homeassistant  3518 Jan 12 20:17 090_good_night.yaml
-rw-r--r-- 1 homeassistant homeassistant  1557 Jan 12 20:23 100_good_morning.yaml
-rw-r--r-- 1 homeassistant homeassistant  9567 Jan 12 20:26 110_input_boolean_modes.yaml
-rw-r--r-- 1 homeassistant homeassistant  4248 Jan 12 20:33 130_automatic_light_automations.yaml
-rw-r--r-- 1 homeassistant homeassistant  1580 Jan 12 20:41 140_water_sensor_automations.yaml
-rw-r--r-- 1 homeassistant homeassistant 10542 Jan 12 21:05 150_hvac_sensor_automations.yaml
-rw-r--r-- 1 homeassistant homeassistant  4560 Jan 12 16:03 160_remote_automation.yaml
-rw-r--r-- 1 homeassistant homeassistant  1488 Jan 12 16:03 170_washing_machine_automations.yaml
-rw-r--r-- 1 homeassistant homeassistant  2895 Jan 12 16:03 190_johnnys_room_automations.yaml
-rw-r--r-- 1 homeassistant homeassistant  3397 Jan 12 16:03 200_input_select_modes.yaml

Example duplicated automation: (all my automations seem to be affected though)

- alias: "030_0002 Exterior Door Opened - Activate Chime"
  trigger:
    - platform: state
      entity_id:
        - binary_sensor.family_room_exterior_door_sensor_opened
        - binary_sensor.front_exterior_door_sensor_opened
        - binary_sensor.garage_exterior_door_sensor_opened
        - binary_sensor.kitchen_exterior_door_sensor_opened
        - binary_sensor.pool_room_exterior_door_sensor_opened
        - binary_sensor.screened_porch_exterior_door_sensor_opened
      from: 'off'
      to: 'on'
  action:
    service: wink.enable_chime
    entity_id: wink.main_floor_chime
    data:
      tone: "doorbell"

This automation does not exist anywhere else in directory structure:

(homeassistant) homeassistant@automation:~/.homeassistant$ find includes/automations/ -type f -exec grep -il "030_0002" {} \;
includes/automations/030_exterior_door_sensors.yaml

Same problem here. Automations are triggered two times in the logbook. Sometimes the actual automation is run, but most of the times noting happens. Running Hassio 0.85.1 on docker host Ubuntu 18.04.

Same here since last update. All automations are listed twice.

Same here since version 0.85 with all automations. Triggered two times and don't work any of them.

Operating environment (Hass.io/Docker/Windows/etc.):
Hassio/rasspberry pi 3 B+

Can confirm this issue from v0.85. Automations are not triggered twice, just Logbook shows two lines for the same record. There is just one record in database for logbook_entry. This happens only for automation logbook trigger entries.

Here's an pull request which causing that: https://github.com/home-assistant/home-assistant/pull/18765
Newly automation triggers and script executions are also logged into database beside logbook entry and both are displayed in frontend.
Btw, for me it is quite confusing. Why automation and scripts are duplicately recorded as logbook_entrythen???

Duplicate records, both showed in frontend:

88962 | logbook_entry        | {"name": "Automatic Theme Change", "message": "has been triggered", domain": "automation", "entity_id": "automation.automatic_theme_change"}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | LOCAL  | 2019-01-16 09:29:46.059927+01 | 2019-01-16 08:29:50.040118+01 | 37127767a56e4964b320f30c84a807fc |
88961 | automation_triggered | {"name": "Automatic Theme Change", "entity_id": "automation.automatic_theme_change"}  

I have the same issues. I was planning to open an issue but luckly I'm not the only one. Hope this will be fixed in next update.

For the record, I have updated from 0.84.x to latest 0.85.1 (hassio) yesterday and noticed the same issues in my logbook.

screenshot 2019-01-19 at 11 08 15
screenshot 2019-01-19 at 11 07 44

Fixed in 0.86 beta 1 (PR #20264).

I have still the same problem in 0.98.2 (installing 0.98.3 now). I'm using MariaDB. It is only the log that is shown double.

Was this page helpful?
0 / 5 - 0 ratings