Hi, I am not a profi developer, so you’d probably laugh at my code :-), but I can guide you through it, was not difficult at all to set it up. I run the cron script every 2 minutes.
First, generate an API key for Hive API - in your Account Profile Settings in Hive.
Then start a script (PHP or any other language) that calls this API call “/farms/{$farmId}/workers”. The response contains an array showing all the details about each worker (including online/offline status), what matters to you is [“stats”][“online”], which should be “true”. See more in the Hive API docs.
So then it comes the IFTTT. Inside it, I have set up a trigger on incoming webhook for each of the smartplugs/rigs (Create - Webhooks - Receive a web request - name it somehow - eg. rig1reset). Then get your IFTTT API key.
The script should then go through the HiveAPI response with any iterator (for/foreach/while) and check if all the workers are online, if not then for how long are they offline and if it’s been already offline for more than 3 minutes (wanted to give it a little time to reboot automatically if possible) than call a webhook from IFTTT like this one “https://maker.ifttt.com/trigger/[trigger_name]/with/key/[your_ifttt_maker_key]” and send me an email about the initiation.
And that’s it. Don’t forget to set your motherboard bios to “auto start when power on” (usually named somehow similar in all bioses). Otherwise, it would not restart after the smart plug is switched off and on again.
I have an IFTTT Pro account (paid) because I had to set up these restart triggers individually to each of the smartplug/rig. And you can have just 2 triggers for free. Don’t know if there is a workaround for that.
I have tried the same approach with TP-Link Kasa HS110, with Sonoff Pow R2 and Woox Smart Plug, but generally, anything that has an open API or is compatible with IFTTT should work properly.