Trigger automation when Insteon switch is turned on/off locally

I’m looking for a way to trigger automation when an Insteon switch is turned on/off but only when it’s done so physically/locally, at the switch.

Can anyone help?

Thanks!

-Mike

Include these conditions in your automation:

conditions:
  - condition: template
    value_template: '{{ trigger.to_state.context.id != none }}'
  - condition: template
    value_template: '{{ trigger.to_state.context.parent_id == none }}'
  - condition: template
    value_template: '{{ trigger.to_state.context.user_id == none }}'

Screenshot 2022-06-21 081430

1 Like

Awesome, I’ll try it tonight. Thank you!

I believe Insteon switches report their physical activity (press/release button) as events. If so, you can use an Event Trigger to detect the events (i.e. detect when someone operates the physical device).

No luck. It won’t let me include conditions: plural. Says “Message malformed: extra keys not allowed @ data[‘conditions’]”. If I change it to condition: like this, it accepts it but the action doesn’t happen. Maybe I’m using the wrong trigger?

alias: Garage Light On by Switch
description: ""
trigger:
  - platform: device
    type: turned_on
    device_id: 6256aaee88409f1e391f4977fa966ed4
    entity_id: aaaa9f97c56a23874e3d8798d9223afc
    domain: switch
condition:
  - condition: template
    value_template: "value_template: '{{ trigger.to_state.context.id != none }}'"
  - condition: template
    value_template: "value_template: '{{ trigger.to_state.context.parent_id == none }}'"
  - condition: template
    value_template: "value_template: '{{ trigger.to_state.context.user_id == none }}'"
action:
  - service: input_boolean.turn_on
    data: {}
    target:
      entity_id: input_boolean.garage_light_on_by_button
mode: single

You’re using the wrong conditions.

Compare what you created:

  - condition: template
    value_template: "value_template: '{{ trigger.to_state.context.id != none }}'"
  - condition: template
    value_template: "value_template: '{{ trigger.to_state.context.parent_id == none }}'"
  - condition: template
    value_template: "value_template: '{{ trigger.to_state.context.user_id == none }}'"

to what tom_l recommended:

conditions:
  - condition: template
    value_template: '{{ trigger.to_state.context.id != none }}'
  - condition: template
    value_template: '{{ trigger.to_state.context.parent_id == none }}'
  - condition: template
    value_template: '{{ trigger.to_state.context.user_id == none }}'

Doh, that was a dumb mistake. Ok, it’s working…Mostly. Usually the automation triggers immediately. Sometimes, randomly, it seems to miss the message. The light turns on locally but the automation doesn’t trigger. If I press on or off again, sometimes 2-3 times, it eventually triggers.

You may want to consider experimenting with what I had suggested and see if it behaves better.

Insteon events

Yeah, I’ll check that out too. Thanks.

No event seems to go to insteon.button_on when any Insteon switch is turned on/off. It looks like it might just be for Mini-Remotes.