#[SOLVED] automation.turn_off ignored if automation.turn_on is in the same automation actions

1 messages · Page 1 of 1 (latest)

stoic lance
#

When I add actions in this order:

actions:
  - action: automation.turn_off
    metadata: {}
    data:
      stop_actions: true
    target:
      entity_id: automation.zalacz_swiatlo_w_przedpokoju
  - action: mqtt.publish
    metadata: {}
    data:
      topic: zigbee2mqtt/Żarówka_3/set
      payload: "{\"brightness_move_onoff\": 60}"
      qos: "2"
      retain: false
      evaluate_payload: false
  - type: turn_on
    device_id: 4c4b3e832fa661782ca493fca31f245f
    entity_id: cd4e6d43b66599dde8020523aaada5f2
    domain: switch
  - action: automation.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: automation.zalacz_swiatlo_w_przedpokoju

the automation.turn_off is ignored.
How do I prevent other automations from triggering when working on things that would normaly trigger them?

glacial veldt
stoic lance
#

it's not the same automation.

#

automation.zalacz_swiatlo_w_przedpokoju is triggered by turn_on on the entity_id: cd4e6d43b66599dde8020523aaada5f2

#

why did it show up as stupid long numbers instead of the name i have for it is beyound me.

glacial veldt
#

i definetly recomend switching to using entity seleciton instead of device. if for no other reason than clarity

stoic lance
#

yes i have

#

device is 2-gang switch

#

what do you suggest i select as action for this switch?

#

as in the main action from the list, before i select the entiti for the action

glacial veldt
#

switch.turn_on

#

then you can select entity

stoic lance
#

hmm... let me check

#
actions:
  - action: automation.turn_off
    metadata: {}
    data:
      stop_actions: true
    target:
      entity_id: automation.zalacz_swiatlo_w_przedpokoju
  - action: mqtt.publish
    metadata: {}
    data:
      topic: zigbee2mqtt/Żarówka_3/set
      payload: "{\"brightness_move_onoff\": 60}"
      qos: "2"
      retain: false
      evaluate_payload: false
  - action: switch.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: switch.przyciski_4_left
  - action: automation.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: automation.zalacz_swiatlo_w_przedpokoju
mode: single
#

that changed nothing.

#

the automation.zalacz_swiatlo_w_przedpokoju fires anyway

glacial veldt
#

can you try adding a short delay between the steps? maybe something needs time to settle

#

can add like 200ms delay between each step or something

stoic lance
#

i can try adding a delay before re-enabling the automation, yes. but everything else need no delay or it might confuse the user.

#

let me try

stoic lance
glacial veldt
stoic lance
#

thanks for the help 🙂

glacial veldt
#

sometimes stuff just needs a moment to settle

stoic lance
#

yea, but the curious thing is it needs delay on re-enabling, not on disabling lol

#

[SOLVED] automation.turn_off ignored if automation.turn_on is in the same automation actions

glacial veldt
#

the disable/reable probably happen so fast everything treats it as if it was never off

stoic lance
#

ah, could be.

glacial veldt
#

just one of those strange quirks you learn to look out for

stoic lance
#

i'm accustomed to industrial automation where nothing is execuded out of order.

#

i don't know if you're familar with Ladder language?

glacial veldt
#

i am not

#

in an ideal world stuff would happen in order but systems are less than ideal unless you build for it

stoic lance
#

in short, in industrial automation everything executes exactly in the order you wrote it. it's to avoid race conditions.

glacial veldt
#

yeah that makes sense

stoic lance
#

the automation.turn_off for me should be treated the same as disable interrupts in industrial automation