Aqara switch trigger works only when light on

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

set it up and and now it shows up last seen. the switch is indeed offline when lights are off. I will try the capacitor see if it fixes it. thanks for help!

2 Likes

Not a problem! Happy to help! (major props to @Sir_Goodenough. I would have never thought about something like that).

1 Like

Please consider marking my post with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps users find answers to similar questions.

For more information about the Solution tag, refer to [guideline 21 in the FAQ]{How to help us help you - or How to ask a good question}.

1 Like

I will definitively mark the post as solution. i just wanted to test it first, and I am not at home currently.

In the meantime do you think all the no neutral switches would require the capacitor? The old Wifi ones I had before, were not working at all without it, they kept flashing.

With the one use now, Aqara E1, it does work better without the capacitor. In relay mode it works normal. Only on decoupled more I have the issue explained.

Reason I am asking this is because Aqara has a better quality switch H1, which I was wondering if would also require the capacitor.

It depends on the resistance of the bulb and the specific switch power requirements. If the devices are in they do use a tiny amount of power but I have no idea how much, Other that that there is no downside to them being there that I know of.

Just installed the capacitor and it works well now. Thank you for helping!

2 Likes