#Aqara Opple switch not triggering

1 messages · Page 1 of 1 (latest)

spice sentinel
#
info  2023-10-16 10:05:28: MQTT publish: topic 'zigbee2mqtt/0x04cf8cdf3c7c4cb5/action', payload 'button_1_single'````
#
description: ""
use_blueprint:
  path: Datortarps/zigbee2mqtt-aqara-opple-switch-2-bands-blueprint-wxcjkg12lm.yaml
  input:
    switch: sensor.0x04cf8cdf3c7c4cb5_action
    button_1_single:
      - service: switch.toggle
        data: {}
        target:
          entity_id: switch.office_standing```
#

Ive tried several different blueprints, none seem to trigger the automation. The blueprint im using above worked on another instance of HA with the same Aqara switch. Not sure what to do now

#
max_exceeded: silent
trigger:
  - platform: state
    entity_id: sensor.0x04cf8cdf3c7c4cb5_action
    attribute: action
action:
  - variables:
      command: '{{ trigger.to_state.state }}'
  - choose:
      - conditions:
          - '{{ command == ''button_1_single'' }}'
        sequence:
          - service: switch.toggle
            data: {}
            target:
              entity_id: switch.office_standing```
trim ledge
#

there is no action attribute on those entities, remove that from the trigger

spice sentinel
#

ok, so just make the trigger look like this?

  - platform: state
    entity_id: sensor.0x04cf8cdf3c7c4cb5_action
action:
  - variables:
      command: '{{ trigger.to_state.state }}'
....```
trim ledge
#

correct

spice sentinel
#

Thanks! Ill give it a shot

#

Worked! Thanks so much, i just had to remove that line from the blueprint and it worked right away.

spice sentinel
#

Ok, so I think my command is still wrong as the automation is triggering but the defined action isn't occurring. I see Choose: No action taken in the trace.

trim ledge
#

then the command was not button_1_single

spice sentinel
#

It looks like it is in the z2m logs but im not totally sure im looking at the right thing: info 2023-10-16 10:05:28: MQTT publish: topic 'zigbee2mqtt/0x04cf8cdf3c7c4cb5/action', payload 'button_1_single'

trim ledge
#

Check the state changes of the entity

#

Easiest is to go to the device in HA and check the log there

spice sentinel
#

all i see in the log book on the entity is 0x04cf8cdf3c7c4cb5 Action 11:57:52 AM - 18 minutes ago 0x04cf8cdf3c7c4cb5 Action changed to button_1_single 11:57:52 AM - 18 minutes ago 0x04cf8cdf3c7c4cb5 Action 11:57:16 AM - 18 minutes ago 0x04cf8cdf3c7c4cb5 Action changed to button_1_single

trim ledge
#

okay, and what do you see in the automation trace

#

especially when you click on the last step, and then changed variables

spice sentinel
#

I see this in the changed variables command: button_1_single

#

In trace timeline though i see:

Triggered by the state of sensor.0x04cf8cdf3c7c4cb5_action at October 17, 2023 at 2:32:41 PM
Define variables command
Choose: Option 1 executed
(scene.office_open) turned 2023-10-17T18:32:41.671766+00:00
(scene.office_open) turned 2023-10-17T18:32:41.671944+00:00
Stopped because of unknown reason "null" at October 17, 2023 at 2:32:41 PM (runtime: 0.01 seconds)```
#

So it looks like its actually catching the command and looks like it's activating the scene but then maybe gets interrupted by the "unknown reason"?

trim ledge
#

Can you share the entire automation

cold glenBOT
#

Please use a code share site to share code or logs, for example:

Please don't use Pastebin, since it can randomly add spaces to the main view. Please also don't share text as images since it makes it harder for people to help you. Remember that others may have colour blindness, impaired vision, etc.

spice sentinel
trim ledge
spice sentinel
#

I just changed the automation from "acivate scene" to "call service" --> toggle light and it works perfectly. So there seems to be something up with the activate scene.

spice sentinel
#

And in the step detail trace i see Executed: October 17, 2023 at 4:05:37 PM Result: params: domain: scene service: turn_on service_data: {} target: entity_id: - scene.office_closed running_script: false

#

So its definitely getting to the right part of the automation. Its just not actually doing the scene change. The scene works when activated manually

spice sentinel
#

@trim ledge Thanks for all your help so far! Any ideas on the above?

trim ledge
#

not sure, that result looks fine

#

does something happen if you put this in devtools > services

#
service: scene.turn_on
target:
  entity_id: scene.office_closed
spice sentinel
#

Yep, the scene activates like you would expect.

trim ledge
#

then I don't have a clue why it doesn't work in the automation, as that one performs the same thing

spice sentinel
#

Is it possible that the state is changing back to no button pressed too quickly? I ask because I see an event in the trace timeline immediately after the button press event that I see the error on. And when i press the button the state changes extremely quickly, so much so that i cant see it really, its just a flicker.

trim ledge
#

no, because you are using trigger.to_state.state

#

oh wait, you are using mode_restart

spice sentinel
#

Should i change that to single?

trim ledge
#

I would suggest to change the trigger

#
trigger:
  platform: state
  entity_id: sensor.0x04cf8cdf3c7c4cb5_action
  not_to: "None"
spice sentinel
#

Interesting. Changed to above and it did one action of the scene. The scenes are just a light and a switch either on or off. When i did the action to turn them off, the light went off but not the switch. Triggered by the state of sensor.0x04cf8cdf3c7c4cb5_action at October 18, 2023 at 4:33:53 PM Define variables command Choose: Option 1 executed (scene.office_closed) turned 2023-10-18T20:33:53.438682+00:00 (light.office_lamp) turned off Stopped because of unknown reason "null" at October 18, 2023 at 4:33:53 PM (runtime: 0.01 seconds)