Aqara switch trigger works only when light on

Hi! I bought an Aqara E1 Double Gang No-Neutral(QBKG38LM) and I am trying to use it in decoupled mode with an automation that toggles the lights(4 Wi-Fi) that are connected to the same circuit.

The switch only triggers when the lights are on or after a few seconds they are off.

I am using Zigbee2MQTT and looking at the logs, I see no errors.

Anyone any ideas what could be the issue?

What is the LQI of the rocker? How many router devices do you have in your mesh? How far is the rocker from the nearest router?

Are you toggling the lights via an automation (derp, I didn’t read enough lol).

Can you paste the YAML for the automation here?

LQI of 236. The switch is in the same room with the coordinator(sky connect). There are 10 router devices. looking at the z2m map 6 of them don’t look connected though. I’n not sure if that’s ok.
here’s the map:

here’s the yaml:

alias: Bind | Cave
description: ""
trigger:
  - platform: device
    domain: mqtt
    device_id: 074c6d7693a743f5e6649cf69298eedf
    type: action
    subtype: single
    discovery_id: 0x54ef4410009fa453 action_single
condition: []
action:
  - if:
      - condition: state
        entity_id: light.cave
        state: "on"
    then:
      - service: light.turn_off
        target:
          entity_id: light.cave
        data: {}
    else:
      - service: light.turn_on
        target:
          entity_id: light.cave
        data: {}
    enabled: true
mode: single

Ah, you’re triggering of the mqtt event. Typical that should be fine, but try this and see if it’s any better:

trigger:
  - platform: state
    entity_id:
      - sensor.kitchen_light_switch_2_action #I don't know the name of your device
    attribute: action
    to: single_top #actions are single_top, single_bottom, double_top, double_bottom
action:
  - service: light.toggle
    target:
        entity_id: light.cave
        data: {}
mode: single

This will toggle the light and let it decide how to handle it internally (rather than you having to check it).

Regarding your map… Those wouldn’t happen to be Ikea GU-10s, would they? Typically they should all be router devices connected to the coordinator, however, depending on how old the firmware is on them, they may have dropped off your mesh. Do you get anything like “Failed to get LQI for ” when generating the map?

The automation does not work at all now, it never get triggered.

And yes, they are Ikea GU-10s. I tried OTA while they are connected but it’s says there is no updated available.

There is also something weird with these lights combined with another Aqara 2 gang no neutral. I have the same setup and when turning the lights on from the switch, after a few seconds the switch turns off.

Paste the new YAML code.

Do you have the IKEA test server set in your Z2M settings?

This sounds more like a signal problem to me. If I’m understanding correctly, you hit the rocker and it toggles on and then a few seconds later toggles off?

So, first thing I would try to do is re-pair the GU-10s and see if they stay connected to the coordinator (or a router closer to them). Same thing for your “Switch | Cave” rocker and see if it connects properly to the mesh.

alias: New automation
description: ""
trigger:
  - platform: state
    entity_id:
      - switch.switch_cave
    attribute: action
    to: single_top
action:
  - service: light.toggle
    target:
      entity_id: light.cave
    data: {}
mode: single

Turned it on now. Is it supposed to find updates? I get this error when checking for updates:

Hit the rocker → Light turns on → Few seconds later rocker turns off the relay. After turning the relay back on, it light stays on.

This needs to the the _action entity.

image

image

It should? What version is it showing in the column to the left? I believe it should be something like version 2.3.093.

That’s um, weird. None of mine do that. Have you had it for a while or is this a new device?

I can’t check properly right now, but I don’t think the attribute: action line is required if you use the action entity.

Something like this:

alias: New automation
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.switch_cave_action
    to: single_top
action:
  - service: light.toggle
    target:
      entity_id: light.cave
    data: {}
mode: single

It should be fine now, but still it won’t get triggered.

alias: New automation
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.switch_cave_action
    attribute: action
    to: single_top
action:
  - service: light.toggle
    target:
      entity_id: light.cave
    data: {}
mode: single

This is the attributes of the entity.

I was expecting z2m to show the action when I hit the rocker, but it only does it if the lights are turned on.

huh, mines are far behind then. it is 1.0.38

Possibly, but I think I was going for verbosity when I wrote the automation for some reason lol

1 Like

Does anything show up in the logbook? I’m having a hard time imaging that the rocker won’t process anything if the light is off unless it’s wired up weird? (I’m in the US, so my wiring might be a bit different than yours).

that’s z2m log

that’s the logbook when light is on. when it’s off there is no log

CleanShot 2024-04-22 at 22.05.57@2x

does it have anything to do with the fact that the lap has 4 lights?

Ahhhhh… ok, now we’re getting somewhere. Try this:

alias: New automation
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.switch_cave_action
    attribute: action
    to: single # I guess your version just uses single?
action:
  - service: light.toggle
    target:
      entity_id: light.cave
    data: {}
mode: single

I already tried that when you first suggested your automation. it works, but again only when the light is on

when light is off, rocker is completely unresponsive

Yeah, that leads me to believe that the wiring might be wrong. It almost feels like that hot wire is coming from the light rather than the load. TBH, I’m not sure :thinking: So, when the light is off, if you look at Z2M, does it show the switch as available?

image

I have 6 of the US rockers (both neutral and non-neutral) and none of them work that way at all.

hmmm, all my devices show Availability: disabled and Last seen: N/A no matter the domain or state. Does this look right?

Uhhhh, nope. That doesn’t look right at all. That means that the last seen attribute isn’t setup. In Z2M, Settings (top bar), go to the Advanced tab and scroll down and set what I have in the screen shot. That will at least give you the last_seen attribute. You can also setup the Availability in the availability tab, but one thing at a time. :slight_smile:

image

Once that is setup (I believe you have to restart Z2M for that setting), then we can troubleshoot why the switch doesn’t respond when the light is off (still boggles my mind).

If a no neutral switch only works when the light is on. it might be that you need a bypass cap/resistor across the bulb to allow more power thru to the switch.

“There are 4 lights”, so that shouldn’t be a problem, but I suspect something like that could be going on as well.

3 Likes

Before the current switches, I used wifi ones which required this capacitor. I assumed this was only the case for wifi switches. I will try installing it again see if it works. Thanks!

1 Like