Auto restart cam when offline

Someone in another thread suggested I document this here.

Background:
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.

1 Like

That was me! :raising_hand_man: Been waiting for this! :worried: Thank you so much for posting it so fast! :heart:

Now I just have to digest it all. :thinking:

Much more complicated than I was envisioning. The IFTTT and Webhook Trigger aren’t complicated, but the periodic ping script is going to be the biggest hurdle for me as I am not running any local computing hardware.

Yeah I hear you! I was hoping that Wyze would have an IFTTT trigger for a device disconnecting from the network - but they don’t (at present), so I had to do something different.

A raspberry pi (or similar) on the network would be perfect for checking the camera and hitting the Webhook.

1 Like

Thats a great idea. Might have to add this to home assistant

2 Likes

I use Home Assistant as well, more of a hobby and experimentation purposes. I decided to use my Hubitat Hub and link it into Home Assistant and create virtual switches. I then have Alexa turn on or off the virtual switch when motion is sensed on a Wyze Senor or a door is open and the Wyze Contact Sensor is activated.

This has worked great as now I can use my Wyze Sensors in Home Assistant via Virtual Switches.

If you have purchased the Home Assistant Cloud Service, you don’t need a hubitat hub. you can simply add Virtual Devices to Alexa and you can set them based on the Wyze Sensor Status.

1 Like

This thread has filled my Buzzword Bingo card…BASH, CURL, IFTTT, Webhook, PING, Script, Rasberry Pi, Aexa, Wyze…BINGO!

1 Like