FCM (Firebase Cloud Messaging) Notifications on iOS [Solved]
Posted: Thursday 21 May 2020 19:33
Hello All,
Domoticz Version 2020.2 is running on RasberryPI and I have DOMOTICZ iOS app (paid version) running on various iOS devices. I had been playing with a dzVent script to send notification for battery levels and I had managed to get a notification to my iPhone. I tried to repeat the exercise but no luck.
My devices are registered in the mobile device page in Domoticz server. In this same page there is a test button. When I press on this button I get a test notification on the desired iOS device.
I decided to investigate and I saw the JSON command used by the TEST button. I then integrated this command in my dzVent script as follows:
The testnotification command works and a notification is sent to a specific device.
I looked in the https://www.domoticz.com/wiki/Domoticz_ ... e_readable and I found this entry
I tried many variants; I looked in the Forums for examples but I could not find anything close. To my limited understanding it seems that FCM is the newer version of GCM (Google Cloud Messaging), Furthermore, it was recently integrated into the Domoticz Server application.
Here is Log information where I see the testnotification sending fcm with success. One then sees THESUBJECT notification but nothing arrives on the iOS. The catch is how to get sendnotification command to be a little more verbose!
Does anyone have any suggestions? 
Domoticz Version 2020.2 is running on RasberryPI and I have DOMOTICZ iOS app (paid version) running on various iOS devices. I had been playing with a dzVent script to send notification for battery levels and I had managed to get a notification to my iPhone. I tried to repeat the exercise but no luck.
My devices are registered in the mobile device page in Domoticz server. In this same page there is a test button. When I press on this button I get a test notification on the desired iOS device.
I decided to investigate and I saw the JSON command used by the TEST button. I then integrated this command in my dzVent script as follows:
Code: Select all
domoticz.openURL('http://192.168.1.30:8080/json.htm?type=command¶m=testnotification&subsystem=fcm&extradata=midx_1')I looked in the https://www.domoticz.com/wiki/Domoticz_ ... e_readable and I found this entry
Decided to try the following line in my script:You can post a notification to a specific notification system with:
/json.htm?type=command¶m=sendnotification&subject=SUBJECT&body=THEBODY&subsystem=SUBSYSTEM
SUBJECT = a string you want to use as subject
THEBODY= a string you want to use as body
SUBSYSTEM= the notification method you want to use
Code: Select all
domoticz.openURL('http://192.168.1.30:8080/json.htm?type=command¶m=sendnotification&subject=THESUBJECT&body=THEBODY&subsystem=fcm&extradata=midx_1')Here is Log information where I see the testnotification sending fcm with success. One then sees THESUBJECT notification but nothing arrives on the iOS. The catch is how to get sendnotification command to be a little more verbose!
Code: Select all
2020-05-21 19:22:36.694 Notification sent (fcm) => Success
2020-05-21 19:22:36.702 Active notification Subsystems: browser, email (2/13)
2020-05-21 19:22:36.706 Status: Notification: THESUBJECT
2020-05-21 19:22:38.038 OpenZWave: Domoticz has send a Switch command! NodeID: 2 (0x02)
2020-05-21 19:22:38.041 (Z-Stick Gen5) Usage (Unknown)
2020-05-21 19:22:38.045 (Z-Stick Gen5) General/kWh (kWh Meter)
2020-05-21 19:22:38.061 (Z-Stick Gen5) Light/Switch (Fibaro Wall Plug 1)
2020-05-21 19:22:38.037 Status: User: Admin initiated a switch command (1/Fibaro Wall Plug 1/Off)
2020-05-21 19:22:38.202 Status: dzVents: Info: Handling events for: "Fibaro Wall Plug 1", value: "Off"
2020-05-21 19:22:38.202 Status: dzVents: Info: ------ Start internal script: Swirchoff: Device: "Fibaro Wall Plug 1 (Z-Stick Gen5)", Index: 1
2020-05-21 19:22:38.203 Status: dzVents: Info: ------ Finished Swirchoff 

