I had quoted my message i.e. with " and it didnt like it once I removed the quotation it worked fine.
On a different note if I have a long message why can’t I see the whole message rather just the first 10 to 15 words on my notification panel?
I had quoted my message i.e. with " and it didnt like it once I removed the quotation it worked fine.
On a different note if I have a long message why can’t I see the whole message rather just the first 10 to 15 words on my notification panel?
I’ve never sent a long notification before. It should be an easy fix to the apk though to add BigTextStyle to the notification. I’ll add that to the “to do list”. Thanks.
Hey guys, I just pushed out a new update both to the fcm-android.py and the hanotify.apk. Take a look at the OP or README.md file. The changes are:
TAG - you can use tag (integer) to give an ID to the notification. Sending another notification with the same tag will overwrite the previous one
DISMISS - you can now just dismiss a notification on your phone from Home Assistant. This is useful for when the notification doesn’t apply anymore. You need to send a TAG with DISMISS of ‘true’ in order to dismiss a previously “tagged” notification. Make sense?
MESSAGE_TYPE - this option allows basic messages to be send as a ‘notification’ instead of a ‘data’. These have a higher priority by default. They can’t be dismiss from Home Assistant or have actions, but you can still use TAG and COLOR on them.
SERVER_KEY - in the configuration.yaml file there is an option to include your own cloud messaging server key for use with your FCM project. You have to replace the google-services.json file in the android app as well.
I have enabled the BigTextStyle so that notifications can be several lines long. There is still a cutoff, but it’s like 6 or 7 lines. That would be one hell of a notification!
I also fixed the warnings in the log about the data[‘token’]. There are some warning about DISMISS and TAG if they aren’t formatted properly (and in that case they won’t be applied)
Let me know what you think or if you come across any issues. I still need to figure out the whole renaming thing. If you have any more suggestions as well I’m all ears.
Good job. Can you add a different icon? As shown in the following code:
- service: notify.android
data:
title: my title
message: "hi"
data:
attachment:
url: https://images-na.ssl-images-amazon.com/images/I/519-zNN1sCL.png
I’m really liking this! I run HA on a windows machine and haven’t ever been able to get native html5 notifications working, so this is very welcomed.
Do you intend to add the ability to send an image with the notification?
@Bottleface no problem, in fact the APK portion is already done. I learned a valuable lesson yesterday about making changes to my Home Assistant when I’m not actually home! Whoops…though end result was a new RPi 3 B+! So I’ll have to do the HA side of things later. I’ll get it out soon, should be a quick and easy change.
@Abeksis I’ll have to look into changing the actual icon instead of that bell thing via the request. From what I’m reading it looks like it can’t be done…though I swear I saw somewhere that someone did it. I’ll keep searching.
Yeah I hate breaking stuff when I’m not home. I know that the app “Join” by joaoapps can dynamically change the icon with each request. I’m not sure of the process, but will this app ever be on the play store?
Hey guys, I added “image” and “icon”.
image - send a picture along with the notification. This sets the notification style to bigpicturestyle so there isn’t as much text…you still get 2 lines though. I foresee a lot of dog pictures being sent!!!
icon - this is the custom notification icon that was requested. Icon is only available with SDK >= 26. If less that that, it’ll default back to the regular one. Make sure to choose an icon that has a transparent background, otherwise Android will just make it a solid block.
Keep the ideas coming!!
Might I suggest some sort of versioning reference at the beginning of your .py file and for the app? Might help prevent any future confusion on the part of your users.
Hey @Crewski, it looks like if you specify an image but not an icon the icon is replaced with the image. The image comes through just fine, but I’m guessing that most of the time images will be non-transparent squares…which don’t look all that great as an icon. In the screenshot below the top notification was created with an image but without an icon. The bottom notification was created with both an image and icon specified (just used the png from your github).
I love this add on! Thank you so much!!
@Crewski
Trying the latest version of both the custom notifier component and APK, I am unable to register the app (‘Something went wrong’ message).
My Hass.IO version is 0.76.2, not using the new Authorization mechanism.
I did have your app and component working OK before updating. I removed the old app and APK from my phone (Android One 8.1.0) before installing the latest version of the APK.
Then I initiated the procedure to use my own (newly setup) Firebase server for the app, using the guide you have added to your Github (clear instructions!).
That went well, I now have my version of the ‘google-services.json’ file.
I downloaded your Github repository for HANotify as zip, unpacked it and replaced your ‘google-services.json’ file for mine.
Then, I imported the ‘HANotify-master’ folder as a project into Android Studio.
But when trying to build my own version of the APK, I run into the following error in the Kotlin compiler:
HANotify-master\app\src\main\java\com\crewski\hanotify\MyFirebaseMessagingService.kt: (135, 174): Unresolved reference: blank_icon
and
HANotify-master\app\src\main\java\com\crewski\hanotify\MyFirebaseMessagingService.kt: (167, 153): Unresolved reference: blank_icon
There seems to be an error in the source code, which I do not have any knowledge of.
As I am also new to Android Studio, perhaps I did something wrong of course.
But all previous errors I ran into while setting up the Android Studio and my first attempts to build the project, I was able to solve using some Googling.
Anyone else been able to build this OK and show some light perhaps?
[EDIT]
Been digging some more…
The error seems to have been caused by a missing .png file the code refers to. To solve the build issue, I have created the missing ‘blank_icon.png’ file in location:
<your projects path>\HANotify\HANotify-master\app\src\main\res\drawable\
Now it builds OK!
@Bottleface Whoops! Thanks for point that out…I left a line of code in there when I was testing stuff. I updated the APK so it should be fixed now.
@IoTmessenger Glad you go it to build. For whatever reason the blank_icon.png wasn’t pushed to the repository. That blank icon is so when you expand a picture notification, the small picture disappears. I have updated things so it is now in there. Are you still having problems with it not registering?
Thank you for mentioning this - I’ve been struggling with image vs. icon for a while now, so this helped me understand! Do you happen to know where I can find a png of the HA logo that works as an icon?
Yeah, I figured that out. Was fun to dig in and learn something new today!
I can register now as well, but the underlying cause had to do with me using Tor to connect remotely to my Hass.IO instance and not your new APK and/or custom component.
At first try after installing the newly created APK, I still could not register to my own server. When using my local IP path to Hass.IO however, it registered OK though.
In the end, I just needed to remove and add the new app to my Tor-enabled Apps for VPN Mode in the Orbot app…
This would most likely have worked as well, when using your Firebase server.
@Brett_C I grabbed a couple icons off of google search and made them “icon friendly”.
You can use the following links.
https://image.ibb.co/jADRXz/HA_Icon.png
Or this one looks decent as well:
Making them “icon friendly” seemed to be my biggest struggle - thanks for sharing!!
Thank you very much!
I’ve been spending days now fighting with the HTML5 component. for some reason it worked well for Firefox but no Chrome and I couldn’t find any documentation for a troubleshooting relevant for that.
This quick add-on does exactly what I needed…
Thanks again for taking the time to make this and share it with us!