Lutron Pico automation does not leave device in the correct state

Hi all,

I’m trying to create a Lutron Pico automation that toggles a Lutron Caseta dimmer switch on/off but it’s not leaving the device in the correct state. Here’s the snippet from automations.yml:

- id: living_room_pico_toggle_lights_current_state_off
  alias: Living Room Pico Toggle Lights (current state 'off')
  description: ''
  trigger:
  - platform: device
    device_id: 78316ab6082f9b328d8ce9679c49052e
    domain: lutron_caseta
    type: press
    subtype: stop
  condition:
  - condition: state
    entity_id: light.living_room_lights
    state: 'off'
  action:
    service: light.turn_on
    entity_id: light.living_room_lights
  mode: queued
- id: living_room_pico_toggle_lights_current_state_on
  alias: Living Room Pico Toggle Lights (current state 'on')
  description: ''
  trigger:
  - platform: device
    device_id: 78316ab6082f9b328d8ce9679c49052e
    domain: lutron_caseta
    type: press
    subtype: stop
  condition:
  - condition: state
    entity_id: light.living_room_lights
    state: 'on'
  action:
    service: light.turn_off
    entity_id: light.living_room_lights
  mode: queued

FYI I’m a noob and have mostly ripped this off from here.

So this works partially but:

When the current state of light.living_room_lights is off hitting the stop button turns the lights on correctly and leaves the state as on. I’ve confirmed this using the Developer → States dashboard.

But, when the current state is on hitting the stop button turns the lights off (briefly), the state transitions to off briefly but in a few milliseconds the state goes back to on but the lights remain off. Leaving the physical device and the state out sync.

Then if I try to toggle again the lights come on briefly but then go back off and the state toggles briefly from on to off but then goes back to on.

Any ideas on how to debug or what the bug in my automation is?

Many thanks in advance!

Note: I am using the Lutron Smart Bridge Pro