SonoffLAN icon indicating copy to clipboard operation
SonoffLAN copied to clipboard

POWR320D randomly Turn Off when Energy entity is enabled in HA

Open sanketgroup opened this issue 1 year ago • 21 comments

Hello POWR320D Firmware: 1.1.1 SonoffLAN: 3.6.0

If I enable the "Energy" entity of POWR320D in HA, the device is getting turned off automatically at random few minutes.

Under HA Logbook (basic), there is no command being sent to the device from HA but device it self Turn off by it self.

This issue happens only when Energy Entity is enabled. If i turn it off, device stay on without any issue.

Surprisingly it also reset the Device's internal stored readings such as "Energy Day" and "Energy Month"

Pls help to resolve this issue.

Thanks

sanketgroup avatar Feb 19 '24 07:02 sanketgroup

Why doesn't anyone read the docs? https://github.com/AlexxIT/SonoffLAN#issues Start by downloading the device diagnostics

AlexxIT avatar Feb 19 '24 07:02 AlexxIT

Sorry for that. I below are log files. I Turned ON the device at 13:48:51

It got automatically Turned Off @ 13:57:35 (i updated POWR320D_debug.txt file, filtered only for specific device)

diagnostic.json debug_log.txt POWR320D_debug.txt

sanketgroup avatar Feb 19 '24 08:02 sanketgroup

I think your device has problems with WiFi. It goes offline a lot

AlexxIT avatar Feb 19 '24 08:02 AlexxIT

so, why it works well when "Energy" entity of this particular device is disabled in HA.

Also, it reset all the counters on device when it Turns Off. Even ewelink shows 0, for "Energy Day" "Energy Month" after it randomly Turns off. It also set "Power-on State" = OFF (even when i saved it as ON or Last State)

Same device at same place worked well for 10 days when "Energy" entity was disabled.

sanketgroup avatar Feb 19 '24 08:02 sanketgroup

Try to collect 24 hours log for this device with disabled energy entity

AlexxIT avatar Feb 19 '24 10:02 AlexxIT

I kept Energy entity disabled for more than 25 hrs.

No auto turn off and no settings on device was changed by it self.

Debug Logs attached. Also attaching screenshot of device activity log showing last it was Turned ON yesterday before 25 hrs. Then there is no OFF or any other activity.

Thanks 2024-02-20_17-45-52

POW_debug_long.txt

sanketgroup avatar Feb 20 '24 12:02 sanketgroup

Well. Only two errors for 10 hours. Not a big deal. Maybe very often energy requests overload your device.

AlexxIT avatar Feb 20 '24 13:02 AlexxIT

but those two errors did not Turned Off the circuit nor it reset anything.

while the energy entity is Turning Off and reset the value of the device.

How should it be resolved ?

sanketgroup avatar Feb 20 '24 13:02 sanketgroup

Just don't use energy entity. Probably it can't be solved from integration side

AlexxIT avatar Feb 20 '24 14:02 AlexxIT

To use this power meter in Energy Dashboard of HA, device must have Energy Entity enabled. Otherwise, it will not be shown in the Energy dashboard.

Since this is power meter, having it in Energy Dashboard is basic requirement

sanketgroup avatar Feb 21 '24 11:02 sanketgroup

https://github.com/AlexxIT/SonoffLAN?tab=readme-ov-file#sonoff-pow

AlexxIT avatar Feb 21 '24 11:02 AlexxIT

ok, need some more clarity.

it says "By default energy data loads from cloud every hour. You can change interval via YAML and add history data to sensor attributes (max size - 30 days, disable - 0). For multi-channel devices use energy_1, energy_2."


sonoff:
  devices:
    1000xxxxxx:
      reporting:
        energy: [3600, 10]  # update interval (seconds), history size (days)

template:
  - sensor:
      - name: "10 days consumpion"
        unit_of_measurement: "kWh"
        state: "{{ (state_attr('sensor.sonoff_1000xxxxxx_energy', 'history') or [])|sum }}"

So lets say if i put this code into config.yaml then it will automatically pull the data every hour (3600sec) and i can use it in energy dashboard.

and what is 10 days consumption, how does it calculate for 10days?

sanketgroup avatar Feb 21 '24 11:02 sanketgroup

Also it says that you can collect energy via Hass. Using only device power sensor.

AlexxIT avatar Feb 21 '24 11:02 AlexxIT

Also you can try to check only cloud mode for component. And only local mode. Maybe problem with energy only via cloud/local. Your device support local energy requests. But I don't have this model for local tests.

AlexxIT avatar Feb 21 '24 11:02 AlexxIT

I just tried. Before it was LAN (local mode), so i turned off LAN mode, and same issue came again. It Turned off the switch by itself.

sanketgroup avatar Feb 21 '24 11:02 sanketgroup

@sanketgroup I have the same issue - thought it was the device, but as soon as I disabled the integration it stopped.

Log Shows: "Device Triggered"

RegardtK avatar Feb 22 '24 16:02 RegardtK

I have few questions:

"Read Me" says By default energy data loads from cloud every hour. You can change interval via YAML and add history data to sensor attributes (max size - 30 days, disable - 0). For multi-channel devices use energy_1, energy_2.

Question: Is really true that it loads from cloud every hour by default. Because my device log does not say that. It is trying to get data from cloud every few seconds rather 3600 seconds. So default does not match with actual log. So i am confused here with interval.

It suggests one option as follow:


sonoff:
  devices:
    1000xxxxxx:
      reporting:
        energy: [3600, 10]  # update interval (seconds), history size (days)

template:
  - sensor:
      - name: "10 days consumpion"
        unit_of_measurement: "kWh"
        state: "{{ (state_attr('sensor.sonoff_1000xxxxxx_energy', 'history') or [])|sum }}"

Question2: above code utilize 'Energy' entity, so it requires me to enable Energy entity, and so it will have the same problem again (Turning Off the device), so how can i use this option?

sanketgroup avatar Feb 23 '24 06:02 sanketgroup

Same issue for me. I've removed the integration from HA since the automatic switch off was a big issue for my usage.

bn4z avatar May 19 '24 12:05 bn4z

First, thank you very much AlexxIT! I also have this problem, enabling energy entity makes the devices randomly turn off. Maybe it's reading this energy too often and crashing the fragile software on the device, I don't know but above comments seems to indicate that. I also have been using many power meters from sonoff for more than a year, and when I tried enabling energy entity, 4-5 of them turned off after a few minutes. The rest would have probably done the same, but I quickly disabled them when I saw the problem.

georgepauna avatar May 31 '24 23:05 georgepauna

To be clear, they are POWR320D and POWR316D

georgepauna avatar May 31 '24 23:05 georgepauna

I wish i had read this before destroying two POWR316D and one POWR3(25A). The strange thing is the entity worked for several days before showing any symptoms like rebooting or turn off randomly so i enable it on all POW device, but now I think I'll go back using riemann sums to calculate energy usage.

And Thanks AlexxIT for this wonderful integration.

citrusian avatar Jun 12 '24 17:06 citrusian