Pretty new to Home Assistant and automation. I have HS300 Kasa Smart Wi-Fi Power Strip with one of the plugs connected to my internet modem\router\gateway. From outside of my home, I occasionally need to hard power cycle my gateway.
In HA, I see the plugs and the ability to click off but as soon as I do, I’m obviously going to be unable to click the “on” control after about 5 seconds.
Is there a device out there that might be better suited that would receive more of a “toggle” command over the network and then automatically do the off, delay, and then on from within the device?
Perhaps if you set up an script that you could call that would turn it off, wait a minute, then turn it back on?
If you are looking for something that will do this by itself, I share a blueprint that does this. Perhaps you can use it if it fits you needs or use pieces of it to make your own magic.
I recommend creating an automation and a helper that’s a toggle.
The trigger would be when the helper is on
The action will be turning the HS300 off, then a delay maybe 30 seconds or 1 minutes or whatever you may like, then turn the HS300 on, then set the helper to off.
I highly suggest you look at the firmware of your Internet router/modem/gateway and see if there is an update because you should not need to reboot your device often enough to need this.
If your power strip has local control of your HS300, you could do an automation that checks whenever that outlet goes to a status of off, power it back on, again. If you need to wait a few seconds, you can have it wait that long before powering back on that switch.
But, the real fix is why is your router/modem/gateway requiring a reboot that often.
If you have a plug through Esphome you can code scripts and delays in the device firmware so local network wouldn’t be required. I use this for a bathroom fan where the smart plug handles the fan control locally. Sorry for the image but phone not letting me select text.
I have my router connected through a Shelly plug S. I have it set to turn on the power automatically one minute after the power is turned off. So I have a button in Home assistant where I can turn off the power to the router. Then the power turns on automatically after a minute and the router boots up again.
Unfortunately it’s due to the buried fiber flexing due to cold\hot\rain. It’s not cheap or annoying enough to fix nor do I have choices for 1G internet other than this provider. Only happens once every few months and I can usually just cycle it when I’m home. However, I will be in another house for the majority of this year and need a good way to reboot remotely.
Is this before or after your DMARC? If it is before, my suggestion would be to make them come out and fix it…keep going up the chain of support until they make a support call. You pay for their service and rebooting equipment is not something a customer should be required to do.
If it is beyond the DMARC, still better to fix the problem. Rebooting equipment always makes me worry because if there is a hardware failure, then you might be dead in the water until it is replaced.
If I were planning to live here longer I would, but I’m planning to move. Not worth my energy at the moment but toggling a switch when it happens remotely or on a schedule is easy enough to do until then.
Could you possibly post the full yaml contents with your sensitive info excluded? Just received my S31 device and have it flashed with the basic config and wanted to see the full context of your snippet - planning to look at the syntax and get familiar with ESPhome later today.
My code is split over several yaml files but this should hopefully give you enough to learn from. I am using an Athom plug which has power/energy monitoring and is overkill for controlling a fan. I have simpler Athom switches but they need to be hard wired in.