Aqara H2 Wall Outlet Randomly Turns On/Off

Hi, long time lurker here, that finally took the plunge to start my HA journey!

I have an Aqara H2 Wall Outlet. This socket is being used for my robot vacuum, so it does not need to be on 24/7. That is why I have created 2 automations for it. To turn on in the middle off the night and a second automation to turn back off in the morning.

However, sometimes I am getting up in the morning because the socket turned back off, randomly. I don’t think it is my automation but rather A. the socket itself or B. Zigbee2MQTT. But I don’t have enough knowledge to be certain of B. Hope to get some help here.

Let’s first start with my setup:
I am running HA in a VM on proxmox.

Core
2025.1.2
Supervisor
2025.02.0
Operating System
14.1
Frontend
20250109.0

My Coordinator is a SLZB-06, connect and powered through PoE.
I am using Zigbee2MQTT.

Zigbee2MQTT version
2.0.0 commit: unknown
Coordinator type
zStack3x0
Coordinator revision
20240710
Coordinator IEEE Address
0x00124b002f8e4bef
Frontend version
0.9.4
zigbee-herdsman-converters version
21.12.0
zigbee-herdsman version
3.2.1

This are my 2 (humble) automations:

alias: Turn On Living Room Socket Robot
description: ""
triggers:
  - trigger: time
    at: "03:30:00"
conditions: []
actions:
  - type: turn_on
    device_id: abaa5487c71d0745980bf91e6a23c06f
    entity_id: e4a1502ea15c663a6039ca89150e9c25
    domain: switch
mode: single
alias: Turn Off Living Room Socket Robot
description: ""
triggers:
  - trigger: time
    at: "09:00:00"
conditions: []
actions:
  - type: turn_off
    device_id: abaa5487c71d0745980bf91e6a23c06f
    entity_id: e4a1502ea15c663a6039ca89150e9c25
    domain: switch
mode: single

Regarding the logs, I still did not find how to export it, so that is why I am providing a screenshot.

As you can see, the automations are being triggered correctly, at the correct time. However it’s the other logs that are causing me problems and I don’t know where they are coming from.

As I don’t have much knowledge (yet!) I tried restarting HA and Z2M. That did not do much. Of course I also searched the community and google my issue but could not find anything related to this.
Hopefully someone can point me in the right direction with a solution or show me how to debug this.

It looks like it originates from the device, not a script of automation. That still does not narrow things down very much. Either manual control, voice control, schedule inside the plug, remote app, accidentally linked to a remote, … I hear Alexa is prome to try to do “smart” things… Could the small button be pressed by something or be stuck in a weird position?

It also has an auto power off if the use drops below a certain value, could that be it?

Normally I’s suspect power loss, but that either turns on or of but not both.

Well it isn’t manual control as it happened in the middle of night.
I also did not setup manual voice control (yet) and we were sleeping :slightly_smiling_face:
I checked the settings of the device and I can’t see anything regarding scheduling. The only thing I found is the charging protection, but it is turned off.
I just went and turned on/off the switch to feel that the button is not stuck in a weird position, but it reacts completely normal.

Is there any other log that I would be able to check??

The 15 power outages are explainable? What is/was the power on behavior?

1 Like

Yes the power outages are explainable, as in I was doing some work in the house so I had to turn on/off the circuit a few times. I don’t if it was 15 times though. I will keep track of this number now.
Power on behaviour has not been changed, I think it is more a memory thing that when the circuit is turned back on again that the outlet should be on/off, take it’s previous state or invert it’s previous state. Still at default value currently.

Yes, but what is the default? If the power is not stable at night, that might turn it on if this setting is on by default.

I cannot see what the default is. I would assume ‘off’ as that’s seem the ‘normal’ behavior. However I have just changed it to ‘previous’. I will monitor it and report back when I have new insights.
Thanks for your help @Edwin_D!

Most lights have on for default, as they may be behind a physical switch. For a socket I would also not think that on is strange as a default. It is a socket, right? Those are normally powered.

Yes it is a socket
I think you are right, they are normally powered. If the default is ‘off’ then that maybe would explain it, however looking at the logs again, it is strange that it turns on/off multiple times

Nothing to report back from yesterday night, everything worked as expected. Will monitor it and get back in a few days with more info. Hopefully changing the setting fixed the issue.

EDIT: I was playing a bit around in HA and suddenly in Z2M I got this error:

Failed to apply calibration to ‘current’: ‘current_precision’ is not a number, got string ()

Would this maybe have something to do with it?

I have been monitoring it for 3 weeks now, and it is still happening. Any ideas?

Go into your Z2M config and look for current_precision. Make a copy and delete the current_precision line if you are still seeing that error.

1 Like

Been monitoring it and the error

is gone thanks!

However I still do get in the logs that on random times, the switch turns on/off. Any ideas about that?