Notify on error via IFTTT
Moderator: Lampi
-
- sehr erfahrener Forum-Nutzer
- Beiträge: 120
- Registriert: So 26. Mär 2017, 11:31
- Wohnort: Sweden
- Mäher: Gardena smart SILENO
- Robonect-Modul: Robonect Hx (Rev.5)
- Robonect Firmware: 1.4
- hat sich bedankt: 6 Male
- wurde gedankt: 20 Male
- Kontaktdaten:
Notify on error via IFTTT
Hi all!
I've made a small perl script which reads the Status field from robonect.
If it is 7 or 8 (error or lost loop signal) I send a request to IFTTT, which in turn sends a notification to my phone.
If anyone would like to use the script, tell me, and I'll make one with a small tutorial attached.
I've made a small perl script which reads the Status field from robonect.
If it is 7 or 8 (error or lost loop signal) I send a request to IFTTT, which in turn sends a notification to my phone.
If anyone would like to use the script, tell me, and I'll make one with a small tutorial attached.
Best regards,
David from Sweden
David from Sweden
-
- sehr erfahrener Forum-Nutzer
- Beiträge: 120
- Registriert: So 26. Mär 2017, 11:31
- Wohnort: Sweden
- Mäher: Gardena smart SILENO
- Robonect-Modul: Robonect Hx (Rev.5)
- Robonect Firmware: 1.4
- hat sich bedankt: 6 Male
- wurde gedankt: 20 Male
- Kontaktdaten:
Re: Notify on error via IFTTT
The code is available here.
You'll also need an account at IFTTT.com, where you'll need to create a "maker" recipe.
If you need instructions on how, I'll try to take some screenshots.
Also, you need a computer/rasberry or similar which can schedule the script.
I'm using a Synology NAS for this, but a simple crontab on linux/mac should suffice.
On windows you'd probably use the task scheduler.
If anyone wants me to, I can try to extend the code further, allowing for the actual error message to be sent to the phone.
EDIT: The maker channel on IFTTT can notify via a vast number of services. Email, SMS, Slack-channel etc. Just pick the one you want.
You'll also need an account at IFTTT.com, where you'll need to create a "maker" recipe.
If you need instructions on how, I'll try to take some screenshots.
Also, you need a computer/rasberry or similar which can schedule the script.
I'm using a Synology NAS for this, but a simple crontab on linux/mac should suffice.
On windows you'd probably use the task scheduler.
If anyone wants me to, I can try to extend the code further, allowing for the actual error message to be sent to the phone.
EDIT: The maker channel on IFTTT can notify via a vast number of services. Email, SMS, Slack-channel etc. Just pick the one you want.
Best regards,
David from Sweden
David from Sweden
-
- sehr erfahrener Forum-Nutzer
- Beiträge: 120
- Registriert: So 26. Mär 2017, 11:31
- Wohnort: Sweden
- Mäher: Gardena smart SILENO
- Robonect-Modul: Robonect Hx (Rev.5)
- Robonect Firmware: 1.4
- hat sich bedankt: 6 Male
- wurde gedankt: 20 Male
- Kontaktdaten:
Re: Notify on error via IFTTT
Example notification via Slack:
In english: Shaun is charging. Battery level 44%.Best regards,
David from Sweden
David from Sweden
Re: Notify on error via IFTTT
Hello,
thanks for the input - I used it as a template sending now mover alert via PHP to Telegram
Regards,
Michael
thanks for the input - I used it as a template sending now mover alert via PHP to Telegram
Regards,
Michael
-
- sehr erfahrener Forum-Nutzer
- Beiträge: 115
- Registriert: Fr 24. Feb 2017, 15:58
- Mäher: Gardena R45Li
- Firmware des Mähers (MSW): MSW 6.xx.xx
- Herstellungsjahr: 2016
- Robonect-Modul: Robonect Hx (Rev.3)
- Robonect Firmware: v1.1b
Re: Notify on error via IFTTT
Nice idea. I would like to have some more Information, on how you Do it, to send Status to telegram, if possible.
Do you created a bot or something?
@larsan it id the better WhatsApp for your Smartphone
Do you created a bot or something?
@larsan it id the better WhatsApp for your Smartphone
Re: Notify on error via IFTTT
Hello,
not really a bot - there is a telegram client for Linux available - so you can use your PI if available.
The code is more or less the same larsan provided.
I scheduled it with cron every 4 minutes.
Cheers,
Gambit
not really a bot - there is a telegram client for Linux available - so you can use your PI if available.
The code is more or less the same larsan provided.
I scheduled it with cron every 4 minutes.
Code: Alles auswählen
#!/usr/bin/php
<?php
$status_code = array();
$status_code["0"]=" Status wird ermittelt";
$status_code["1"]=" parkt";
$status_code["2"]=" arbeitet";
$status_code["3"]=" sucht die Ladestation";
$status_code["4"]=" lädt";
$status_code["5"]=" sucht (wartet auf Umsetzen)";
$status_code["7"]=" braucht Hilfe - FEHLER!";
$status_code["8"]=" braucht Hilfe - Schleifensignal verloren!";
$status_code["16"]=" ist abgeschaltet";
$status_code["17"]=" schläft";
$url = "http://192.168.0.135/json?cmd=status";
$cURL = curl_init();
curl_setopt($cURL, CURLOPT_URL, $url);
curl_setopt($cURL, CURLOPT_HTTPGET, true);
curl_setopt($cURL, CURLOPT_RETURNTRANSFER, true);
curl_setopt($cURL, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Accept: application/json'
));
$result = curl_exec($cURL);
curl_close($cURL);
$back=json_decode($result,true);
$name = $back['name'];
$status = $back['status']['status'];
$all_back = $name.$status_code[$status];
$duration = $back['status']['duration']/60;
if ($duration<5 and $status==7) $ret=shell_exec("/home/pi/telegram_send_home.sh
'$all_back'");
?>
Gambit
-
- sehr erfahrener Forum-Nutzer
- Beiträge: 115
- Registriert: Fr 24. Feb 2017, 15:58
- Mäher: Gardena R45Li
- Firmware des Mähers (MSW): MSW 6.xx.xx
- Herstellungsjahr: 2016
- Robonect-Modul: Robonect Hx (Rev.3)
- Robonect Firmware: v1.1b
Re: Notify on error via IFTTT
Thanks a lot. Seems like i have to search for my old Rasp in the deeps of my cupboard, to reactivate it again