HomeKey kann eine Push-Benachrichtigung senden, sobald ein Besucher an der Haustüre klingelt.
Da nur die CCU2 + CCU3 eine kompatible wget-Binary mitliefert, ist die nachfolgende Beschreibung nur unter der CCU2 + CCU3, nicht aber für die CCU1, gültig.
Hinweis: Ich habe mich bewusst für ein offenes Script anstelle eines Plugins entschieden, um den Prozess transparent zu halten. Aus Sicherheitsgründen wird hierbei ausschließlich direkt mit der Google Cloud Messaging API kommuniziert.
Um die Benachrichtigung aufs Smartphone einzurichten, muss in der HomeMatic ein neues Programm hinzugefügt werden, dass auf die Türklingel reagiert, z.B. durch eine Funk-Tasterschnittstelle (HM-PBI-4-FM):
! Geräte ID (mehrere IDs getrennt durch \t)
string registration_id = "<hier die Registrierungs-ID eingeben>";
! Benachrichtigungsquelle
var dp = dom.GetObject("$src$");
var chan;
string src;
if (dp != null) {
var chan = dom.GetObject(dp.Channel());
src = chan.Name();
}
! Benachrichtigung
string address = "<hier die Adresse der KeyMatic hinein (ohne Kanal)>";
string title = "Ding-Dong";
string message = src # " am " # system.Date("%d.%m.%Y %H:%M:%S") # " Uhr";
string registration_ids = "";
string tmp;
foreach(tmp, registration_id) {
if (registration_ids != "") {
registration_ids = registration_ids # '\\",\\"';
}
registration_ids = registration_ids # tmp;
}
string stdout;
string stderr;
string cmd = 'wget -q -T 5 -O /dev/null --no-check-certificate --header="Authorization: key=AAAAMuGLCjA:APA91bFPa2nCmo9an8N-hncB-vGDGsrC2hLv1ftL1YNG8j70AuumOqWXuWxnvAlFq_-JNwR8JOsZQAP7HEFavsdUtryGbI27r2opH9GeHAyqPSe40UOdAa_I08sy1-5gphUpGEnG4vxs" --header="Content-Type: application/json" --post-data="{\\"registration_ids\\":[\\"' # registration_ids # '\\"],\\"data\\":{\\"title\\":\\"' # title # '\\",\\"message\\":\\"' # message # '\\",\\"address\\":\\"' # address # '\\"}}" https://fcm.googleapis.com/fcm/send';
system.Exec("sh -c '" # cmd # "'", &stdout, &stderr);
! Geräte ID (mehrere IDs getrennt durch \t)
string registration_id = "<hier die Registrierungs-ID eingeben>";
! Benachrichtigungsquelle
var dp = dom.GetObject("$src$");
var chan;
string src;
if (dp != null) {
var chan = dom.GetObject(dp.Channel());
src = chan.Name();
}
! Benachrichtigung
string address = "<hier die Adresse der KeyMatic hinein (ohne Kanal)>";
string title = "Ding-Dong";
string message = src # " am " # system.Date("%d.%m.%Y %H:%M:%S") # " Uhr";
string registration_ids = "";
string tmp;
foreach(tmp, registration_id) {
if (registration_ids != "") {
registration_ids = registration_ids # '\\",\\"';
}
registration_ids = registration_ids # tmp;
}
string cmd = 'wget -q -T 5 -O /dev/null --no-check-certificate --header="Authorization: key=AAAAMuGLCjA:APA91bFPa2nCmo9an8N-hncB-vGDGsrC2hLv1ftL1YNG8j70AuumOqWXuWxnvAlFq_-JNwR8JOsZQAP7HEFavsdUtryGbI27r2opH9GeHAyqPSe40UOdAa_I08sy1-5gphUpGEnG4vxs" --header="Content-Type: application/json" --post-data="{\\"registration_ids\\":[\\"' # registration_ids # '\\"],\\"data\\":{\\"title\\":\\"' # title # '\\",\\"message\\":\\"' # message # '\\",\\"address\\":\\"' # address # '\\"}}" https://fcm.googleapis.com/fcm/send';
dom.GetObject("CUxD.CUX2801001:1.CMD_EXEC").State("sh -c '" # cmd # "'");
curl -H "Authorization: key=AAAAMuGLCjA:APA91bFPa2nCmo9an8N-hncB-vGDGsrC2hLv1ftL1YNG8j70AuumOqWXuWxnvAlFq_-JNwR8JOsZQAP7HEFavsdUtryGbI27r2opH9GeHAyqPSe40UOdAa_I08sy1-5gphUpGEnG4vxs" -H "Content-Type: application/json" -X POST -d '{"registration_ids":["<hier die Registrierungs-ID eingeben>"],"data":{"title":"Ding-Dong","message":"Jemand steht an der Tür"}}' https://fcm.googleapis.com/fcm/send
"data":{"alarm":"Alarmzone 1","message":"Alarm wurde ausgelöst!"}