Can't get my first automation to work

OK, “New to HA”, Trying to learn automations for Insteon devices.

I have been working on this and I am just stuck. I have an Insteon open/close sensor and I am trying link it to a lamplink on/off dimmer module. I have finally gotten it to work (occasionally) When I initially start the automation by opening the sensor, the lamplink comes on, stays on and all is good. But when I close the sensor, wait a while and try the second or subsequent times either the lamplink doesn’t fire at all, or sometimes it comes on only to go back off after 10-15 seconds.

Here are my settings:
Home Assistant 2022.7.6
Supervisor 2022.07.0
Operating System 8.2
Frontend 20220707.1 - latest

And here is the code form automations.yaml

- id: '1658447125407'
  alias: Open_Close
  description: ''
  trigger:
  - type: opened
    platform: device
    device_id: 2375c1abe1649d107a860c9b9b9795e4
    entity_id: binary_sensor.open_close_sensor_2d_dc_fe
    domain: binary_sensor
  condition: []
  action:
  - service: light.turn_on
    data:
      brightness_pct: 100
    target:
      entity_id: light.lamplinc_dimmer_18_a1_da
  mode: single

Also if I have broken some protocol with this post also please let me know, it’s my first post to the forums.

Do you have an automation that turns the light off? Or are you doing manually?

Thanks for the Reply [zoogara] Just doing it manually till I get the ‘on’ routine working.

It looks fine - apart from being generated by the UI :smiley: - so it’s probably not the automation.

What does the trace say (Show Trace while editing the automation) and what is in the log? Another good place to look is in the history tab of the light and sensor - that will help you understand what’s going on.

I prefer the old automation style - I find it easier to read. This is the one that turns on my lights:

alias: Office Light Switch ON
initial_state: true
trigger:
  platform: state
  entity_id: binary_sensor.office_lights_switch
  to: 'on'
action:
  service: light.turn_on
  data:
    entity_id: light.room_light, light.floor_lamp
    color_name: white
    brightness: 255
id: df149804822940b3ac2039fc3b004788

Odd thing is when I look at the trace, it’s not complete, back to the old drawing board. I will try your style next.

type: opened
platform: device
device_id: 2375c1abe1649d107a860c9b9b9795e4
entity_id: binary_sensor.open_close_sensor_2d_dc_fe
domain: binary_sensor

Look at the history of light.lamplinc_dimmer_18_a1_da. It should show if an automation turned it on or off, or some other action. Do your lights have a cloud based app? Maybe it’s overriding.

I finally figured it out. Had to go into the All-Link Database and delete all the instances of both the light and the sensor as controllers and/or responders. Working great now.