Someone in another thread suggested I document this here.
I recently bought a new Wyze Cam v3 but had problems with the camera just dropping off the wifi network and returning error code 90. This problem was somewhat alleviated by using the latest beta firmware for the cam, but at least once per day the cam would drop. No other devices were having the same problem.
I wanted a solution to automatically power cycle the camera when it lost connection.
I purchased a cheap smart power plug (Mirabella Genio) and plugged the cam power brick into that. Now I needed a way to detect when the camera was off network and a way to tell the smart plug to power cycle.
I looked into IFTTT (If This Then That) to see if anyone had created methods that would do what I wanted. However it appears that Mirabella weren’t using IFTTT anymore (no idea why), but the plug was a generic “Tuya” device and could be controlled by “Smart Life” app - which does support IFTTT.
First thing I connected the smart plug in the “Smart Life” app. I then created a “scene” in the app which instructed the plug to switch off, wait three seconds and then switch back on.
Then I used the “Webhook” applet in IFTTT to trigger the scene I had made. The applet provides you with a unique webhook URL as the trigger for the applet.
To detect the camera was down, I wrote a small BASH script on my home server which resides on the same network. The script would perform a ping to the IP address of the camera and if this failed, the script would use curl to hit the webhook. This would trigger the IFTTT applet and the power plug would power cycle the camera.
I added a couple of lines to log when this was happening, so that I could track it later. I added the script to cron to run every 5 minutes.
So far it has worked quite well. I will monitor it for a while to see how often it is triggered and if I need to alter how often it runs.
If you have any questions about the above, let me know.