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

Trigger an automation only when not activated via the UI (mechanical switch)

$
0
0

Hello!

I have found a little bug in the triggers, if I fire up a switch via the Lovelace UI, and into a period of a couple of seconds (minus than 5) I fire up the same switch via a mechanical switch, the trigger.to_state.context.user_id is still populated and not none. could there be some delay in writing down that uid when populating it via a switch? or maybe the delay from the device to homeassistant server?

My server is not really busy, 5% cpu at max, but wondered if the device interrogation at this point could be made faster, I would prefer hammering them, than have a couple of seconds delay, considering that my device are lan triggered (sonoff ewelink, lan controlled)

only for reference, automation, with ids redacted:

alias: Commute
description: ""
triggers:
  - type: turned_on
    device_id: d1
    entity_id: e1
    domain: switch
    trigger: device
conditions:
  - condition: and
    conditions:
      - condition: template
        value_template: >-
          {{ trigger.to_state.context.user_id is none }}
actions:
  - type: toggle
    device_id: d1
    entity_id: e2
    domain: switch
mode: single

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 105777

Trending Articles



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