Hey guys, sorry I didn’t add the “target” attribute to the table in the OP…it’s in there now. All you have to do is add
target: unnamed device_2
to your notification. This goes at the root, along with title and message.
@Shayne_Bergan I handled the timestamps on the Home Assistant side so that I know when the notification was actually called, not when it’s received…though these two time are typically very close. I use
message: "Anna is home at {{ now().strftime('%I:%M %p') }}."
In the settings where you turn on Push Notifications, do you get a toast message that says that you are registered?
After selecting push messages, do you now have a fcm-android-registrations.conf file in your config/ ? And in that file is there at least 1 JSON object with a name and token?
As far as the setup you have it right. I guess I should also mention to reboot after putting the fcm-android in place, but I’m assuming you already did that.
I see that I am missing fcm-android-registrations.conf and I’m failing at getting one…
When using your version of HA app (release 2018-09-11 10:55:25) it crashes when checking or unchecking Settings > Push Notification with error HomeAssist keeps stopping. Tried with local http and external https. Tried with HANotify v1-0-1.apk installed beside and without.
Sounds like we need to test if the rest api service is exposed through NGINX (which I have no experience with). Only reason I’m thinking this is because the examples show a separate “location” for websockets.
The fcm-android.py exposes 2 endpoints, /api/notify.fcm-android and /api/notify.fcm-android/callback. Using either Postman from a separate computer (I’m guessing) or a Rest Api app on your phone (https://play.google.com/store/apps/details?id=com.sn.restandroid) lets try to hit the first endpoint.
So, send a POST request to https://yourdomain.com:8123/api/notify.fcm-android (make sure /api/notify.fmc-android is all lowercase). Include the header x-ha-access with your api_password. Hit send, what do you get?
If you get a response that says
{
"message": "Invalid JSON"
}
then there is proper communication and the api service is working. If you get something else (such as a 404 error) then the problem is most likely with the NGINX setup.
Can someone please tell me how I can send custom actions clicked “fcm_android_notifications.clicked” from tasker using the same token and then building automations around that in HA?
Basically just like the action that pressing on the button on the notification does but a custom one
For dismissing, you can use the “dismiss” function of HANotify. In order to use it, you have to use “tag” as well. So basically you would just make an automation that sends one with tag of “dismissthis” (or whatever you want). Then add a delay for X seconds. The next action will have the same tag but with “dismiss” as true. Let me know if that makes sense.
I haven’t used tasker in a long time. A quick search found that you can’t add the headers in the tasker app alone. But if you install RESTask it looks like it handles it. The JSON with the action, type, and token are put into the body. Hopefully that’ll get you going in the right direction.