core: Wait_template is not working correctly, it triggers final step without TRUE condition if called twice in "timeout" period.

Home Assistant release with the issue:

Last working Home Assistant release (if known): I don’t know i try this first time.

Operating environment (Hass.io/Docker/Windows/etc.):

hass.io

Component/platform:

Automation.

Description of problem: I try to use wait_template. But it is not working correctly, it triggers final step without TRUE condition if called twice in “timeout” period.

Step by step what id does:

  1. Main condition is triggered (device_tracker.samsunggalaxys7 is at home) - i am near my home
  2. email is sent (that starting “XXX …”)
  3. 15 minutes countdown is started and it waits for device_tracker.itag (BLE tracker) state “home”
  4. now i go away from home so samsunggalaxys7 state is “not-home” again
  5. now i go back near my home so samsunggalaxys7 state is “home” again - still in 15min delay!
  6. automation is triggered again but - no email is sent (first action is not triggered), script is called directly (third action) without wait-template condition equals to true!!

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

- alias: Kontrola příchodu domu Petr
  trigger:
    platform: zone
    entity_id: device_tracker.samsunggalaxys7
    zone: zone.home
    event: enter
  action:
    - service: notify.emailpetr
      data:
        title: XXX Petr vlezl do zóny a jdu sledovat BLE
        message: doma a jdu sledovat BLE 15min
    - wait_template: "{{ is_state('device_tracker.itag', 'home') }}"
      timeout: 00:15:00 
      continue_on_timeout: 'false'
    - service: script.prichod_domu

Sorry for czech language but i thing it doesn’t matter here.

Traceback (if applicable):


Additional information: Proof of points above, relevant log messages here: 1:

2018-10-01 16:57:33 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event logbook_entry[L]: name=Kontrola příchodu domu Petr, message=has been triggered, domain=automation, entity_id=automation.kontrola_prichodu_domu_petr>
2018-10-01 16:57:33 INFO (MainThread) [homeassistant.helpers.script] Script Kontrola příchodu domu Petr: Running script
2018-10-01 16:57:33 INFO (MainThread) [homeassistant.helpers.script] Script Kontrola příchodu domu Petr: Executing step call service

2:

2018-10-01 16:57:33 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=notify, service=emailpetr, service_data=title=XXX Petr vlezl do zóny a jdu sledovat BLE, message=doma a jdu sledovat BLE 15min, service_call_id=8dd9d45120984f379a6bc5abbfd5e910>

3: I thing 15min waiting has no log message…

4:

2018-10-01 17:02:42 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=device_tracker.samsunggalaxys7, old_state=<state device_tracker.samsunggalaxys7=home; source_type=gps, latitude=50.0083262, longitude=14.417486, gps_accuracy=21, battery=72.0, speed=0.0, direction=0.0, altitude=0.0, provider=network, activity=IN_VEHICLE, friendly_name=Petr, icon=mdi:mdi-gender-male, entity_picture=/local/petr.png @ 2018-10-01T16:57:33.696961+02:00>, new_state=<state device_tracker.samsunggalaxys7=not_home; source_type=gps, latitude=50.00768208013503, longitude=14.416353704863297, gps_accuracy=4, battery=71.0, speed=0.0, direction=0.0, altitude=278.0139468828492, provider=gps, activity=, friendly_name=Petr, icon=mdi:mdi-gender-male, entity_picture=/local/petr.png @ 2018-10-01T17:02:42.760000+02:00>>

5:

2018-10-01 17:04:20 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=device_tracker.samsunggalaxys7, old_state=<state device_tracker.samsunggalaxys7=not_home; source_type=gps, latitude=50.00768208013503, longitude=14.416353704863297, gps_accuracy=4, battery=71.0, speed=0.0, direction=0.0, altitude=278.0139468828492, provider=gps, activity=, friendly_name=Petr, icon=mdi:mdi-gender-male, entity_picture=/local/petr.png @ 2018-10-01T17:02:42.760000+02:00>, new_state=<state device_tracker.samsunggalaxys7=home; source_type=gps, latitude=50.00772, longitude=14.4176324, gps_accuracy=21, battery=71.0, speed=0.0, direction=0.0, altitude=0.0, provider=network, activity=, friendly_name=Petr, icon=mdi:mdi-gender-male, entity_picture=/local/petr.png @ 2018-10-01T17:04:20.742952+02:00>>

6:

2018-10-01 17:04:20 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event logbook_entry[L]: name=Kontrola příchodu domu Petr, message=has been triggered, domain=automation, entity_id=automation.kontrola_prichodu_domu_petr>
2018-10-01 17:04:20 INFO (MainThread) [homeassistant.helpers.script] Script Kontrola příchodu domu Petr: Executing step call service
2018-10-01 17:04:20 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=script, service=prichod_domu, service_data=, service_call_id=b32077767d674105ad457ed3f570be65>

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 2
  • Comments: 16 (5 by maintainers)

Most upvoted comments

Yes still broken. But i have workaround. In service part call custom script and in that script check condition again and after condition call desired service.