athom-tech / esp32-configs

ESP32 configuration for athom device
26 stars 8 forks source link

Prevent V3 plug relay toggle during restart/flash? #7

Open Omar007 opened 4 months ago

Omar007 commented 4 months ago

Currently the relay state is restored to ON during boot just fine but during a restart (through HA or caused by flashing an update), the relay shortly flips to OFF before being restored back to ON. Is there a way to prevent this toggle from happening or is that just something that will always happen due to how it's wired?
Going by how it sounds like when it looses power as a whole, it seems like the latter might be true. The relay always toggles off; it's wired up as a normally open relay?

It switching to OFF when there's no power is honestly fine. If there's a complete power outtage it really does not matter. When just simply updating it, it is quite inconvenient that it toggles and, as a result, powers off everything connected to it or that you need to first power off everything connected to it before you can safely update one.

uniqueandy29 commented 4 months ago

Are you able to add the below in, i believe this will solve our issue

early_pin_init (Optional, boolean): Specifies whether pins should be initialised as early as possible to known values. Recommended value is false where switches are involved, as these will toggle when updating the firmware or when restarting the device. Defaults to true.

Omar007 commented 4 months ago

Unfortunately that's not an option for this variant of the plug. That flag is available on the ESP8266 platform but not on the ESP32 platform.

SirCadian commented 4 months ago

I don't think this is just the v3 plug. Recently my V2 plug has been toggling off and on during flash and restart. I use it to monitor power usage to my PC, so this is not good. The flash update power cycle can be worked around but I've had the plug restart without warning a couple of times and lost my work on my PC. I've taken the PC off the plug for the time-being until the issue is sorted.

tarontop commented 2 months ago

If necessary we can release a version without relays, which will avoid the problem of power disconnection.

Roving-Ronin commented 2 months ago

If necessary we can release a version without relays, which will avoid the problem of power disconnection.

@tarontop Aiden,

Sounds interesting, the main issue with the Athom plugs is that after a while a % of them have the relay fail. Only way around that at the moment is using something like a Shelly Gen3 Mini PM (no relay), but the option of an "Athom Smart Plug v3 PM" would be a good (easier to install) option. Would also be of interest to a friend for his customers wanting to be able to easily/rapidly install or replace plugs in a commerical environment and NOT have the risk of relays failing and causing stock losses (or someone accidentally turning the relay off).

No relay should mean a saving of a couple of $ on the parts cost.... maybe ESP32-C6 (Matter / Thread and 802.11ax WiFi) boards also ? ;-)

uniqueandy29 commented 2 months ago

I would buy this :) I do have devices were it is just for monitoring the energy consumption

Omar007 commented 2 months ago

While just a PM variant can def. be interesting for certain situations, it can not cover the same uses as a switched one.
For example, I use this plug for devices that I want to monitor and that can only be reset with a power cycle. However, I only want to power cycle if a reset is actually needed, not every time I update the plug or something.
And while "just don't update it" would prevent a reboot, that should not be something to suggest for connected devices :thinking:

tarontop commented 17 hours ago

The EU version has been released, and the AU/NZ version will be released later

https://www.athom.tech/blank-1/no-relay-consumption-monitoring-eu-plug-for-esphome

SirCadian commented 16 hours ago

The EU version has been released, and the AU/NZ version will be released later

https://www.athom.tech/blank-1/no-relay-consumption-monitoring-eu-plug-for-esphome Went to buy and then realised it's EU and I'm UK, Doh! Great to see this though, will there be a UK version?