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.

Moderator: Lampi

larsan
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

Beitrag von larsan »

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
Forum-Anfänger
Beiträge: 4
Registriert: Di 19. Jul 2016, 09:27

Re: Notify on error via IFTTT

Beitrag von Gambit »

Hello,

yes please provide some information :-)

Regards,
Gambit

larsan
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

Beitrag von larsan »

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

Beitrag von larsan »

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

Gambit
Forum-Anfänger
Beiträge: 4
Registriert: Di 19. Jul 2016, 09:27

Re: Notify on error via IFTTT

Beitrag von Gambit »

Hello,

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

Regards,
Michael

larsan
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

Beitrag von larsan »

Cool

What's telegram?
Best regards,
David from Sweden

pirni
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

Beitrag von pirni »

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
Forum-Anfänger
Beiträge: 4
Registriert: Di 19. Jul 2016, 09:27

Re: Notify on error via IFTTT

Beitrag von Gambit »

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

Beitrag von larsan »

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

pirni
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

Beitrag von pirni »

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“