Notify on error via IFTTT

Du möchtest Deinen Automower in Deine Hausautomatisierung einbinden oder eine eigene App entwicklen?
Hier wird diese offene Schnittstelle zum Robonect Hx Modul beschrieben.
larsan
Beiträge: 66
Registriert: So 26. Mär 2017, 11:31
Wohnort: Sweden
Mäher: Gardena R40Li
Firmware des Mähers (MSW): MSW 5.xx.xx
Herstellungsjahr: 2012
Robonect-Modul: Robonect H30x (Rev.2)
Robonect Firmware: 1.0a

Notify on error via IFTTT

Beitrag von larsan » Sa 8. Apr 2017, 08:37

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.
Best regards,
David from Sweden

Gambit
Beiträge: 4
Registriert: Di 19. Jul 2016, 09:27

Re: Notify on error via IFTTT

Beitrag von Gambit » Mo 10. Apr 2017, 09:18

Hello,

yes please provide some information :-)

Regards,
Gambit

larsan
Beiträge: 66
Registriert: So 26. Mär 2017, 11:31
Wohnort: Sweden
Mäher: Gardena R40Li
Firmware des Mähers (MSW): MSW 5.xx.xx
Herstellungsjahr: 2012
Robonect-Modul: Robonect H30x (Rev.2)
Robonect Firmware: 1.0a

Re: Notify on error via IFTTT

Beitrag von larsan » Mo 10. Apr 2017, 11:08

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. :)
Best regards,
David from Sweden

larsan
Beiträge: 66
Registriert: So 26. Mär 2017, 11:31
Wohnort: Sweden
Mäher: Gardena R40Li
Firmware des Mähers (MSW): MSW 5.xx.xx
Herstellungsjahr: 2012
Robonect-Modul: Robonect H30x (Rev.2)
Robonect Firmware: 1.0a

Re: Notify on error via IFTTT

Beitrag von larsan » Mi 12. Apr 2017, 12:27

Example notification via Slack:
fullsizeoutput_ba4.jpeg
fullsizeoutput_ba4.jpeg (35.74 KiB) 3160 mal betrachtet
In english: Shaun is charging. Battery level 44%.
Best regards,
David from Sweden

Gambit
Beiträge: 4
Registriert: Di 19. Jul 2016, 09:27

Re: Notify on error via IFTTT

Beitrag von Gambit » Do 13. Apr 2017, 15:02

Hello,

thanks for the input - I used it as a template sending now mover alert via PHP to Telegram :)

Regards,
Michael

larsan
Beiträge: 66
Registriert: So 26. Mär 2017, 11:31
Wohnort: Sweden
Mäher: Gardena R40Li
Firmware des Mähers (MSW): MSW 5.xx.xx
Herstellungsjahr: 2012
Robonect-Modul: Robonect H30x (Rev.2)
Robonect Firmware: 1.0a

Re: Notify on error via IFTTT

Beitrag von larsan » Do 13. Apr 2017, 15:07

Cool

What's telegram?
Best regards,
David from Sweden

pirni
Beiträge: 113
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

Beitrag von pirni » Sa 15. Apr 2017, 09:58

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 ;)

Gambit
Beiträge: 4
Registriert: Di 19. Jul 2016, 09:27

Re: Notify on error via IFTTT

Beitrag von Gambit » Mi 19. Apr 2017, 14:13

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.

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'");
?>
Cheers,
Gambit

larsan
Beiträge: 66
Registriert: So 26. Mär 2017, 11:31
Wohnort: Sweden
Mäher: Gardena R40Li
Firmware des Mähers (MSW): MSW 5.xx.xx
Herstellungsjahr: 2012
Robonect-Modul: Robonect H30x (Rev.2)
Robonect Firmware: 1.0a

Re: Notify on error via IFTTT

Beitrag von larsan » Do 20. Apr 2017, 08:46

Nice. A real JSON-parser too. :)
Best regards,
David from Sweden

pirni
Beiträge: 113
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

Beitrag von pirni » Fr 21. Apr 2017, 07:55

Thanks a lot. Seems like i have to search for my old Rasp in the deeps of my cupboard, to reactivate it again :D

Antworten

Zurück zu „API für Robonect® Hx“