SonoffLAN
SonoffLAN copied to clipboard
POWR320D randomly Turn Off when Energy entity is enabled in HA
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
Why doesn't anyone read the docs? https://github.com/AlexxIT/SonoffLAN#issues Start by downloading the device diagnostics
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)
I think your device has problems with WiFi. It goes offline a lot
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.
Try to collect 24 hours log for this device with disabled energy entity
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
Well. Only two errors for 10 hours. Not a big deal. Maybe very often energy requests overload your device.
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 ?
Just don't use energy entity. Probably it can't be solved from integration side
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
https://github.com/AlexxIT/SonoffLAN?tab=readme-ov-file#sonoff-pow
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?
Also it says that you can collect energy via Hass. Using only device power sensor.
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.
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 I have the same issue - thought it was the device, but as soon as I disabled the integration it stopped.
Log Shows: "Device Triggered"
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?
Same issue for me. I've removed the integration from HA since the automatic switch off was a big issue for my usage.
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.
To be clear, they are POWR320D and POWR316D
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.