Android actionable notifications

Hey guys, sorry I’ve been gone for a while.

@travislpriest sounds like you all got the “tag” thing figured out.

@Eddie1974 I do have some experience with Node Red (I did my own home automation with it before moving to Home Assistant) but unfortunately I have not played with NR and how it interacts with Home Assistant. That is on my to do list to play with that, but time is sparse right now. If you figure it out, report back to help others. Thanks.

@3oh6 The image needs to be a URL that you can access. I store my image into the config/www folder since it is accessible as local. See my example below:

send_image_notificaion:
  sequence:
    - service: camera.snapshot
      data:
        entity_id: camera.amcrest_camera
        filename: /config/www/cam_captures/jakes_room_{{ now ().year }}_{{ now ().month }}_{{ now ().day }}_{{ now ().hour }}_{{ now ().minute }}.jpg
    - delay: 
        seconds: 5
    - service: notify.android
      data_template:
        title:  Camera Motion
        message:  Motion detected in Jake's room
        data:
          image:  "https://yourhainstance:haport/local/cam_captures/jakes_room_{{ now ().year }}_{{ now ().month }}_{{ now ().day }}_{{ now ().hour }}_{{ now ().minute }}.jpg"
1 Like

I’m getting the following error after restarting HA with the custom component file added and the config added into my configuration.yaml file. Any idea what’s going on here?

SyntaxError: invalid syntax
Fatal error while loading config: invalid syntax (fcm-android.py, line 7)
Failed config
  General Errors: 
    - invalid syntax (fcm-android.py, line 7)
Successful config (partial)

That is part of a larger error, but seemed to be the core part of it.

This is my config just to be clear. I haven’t added it to any automations in yet.

notify:
  - name: android
    platform: fcm-android

I assume I missed something? Any help would be appreciated.

@coup Sounds like you cut and paste from the github file. Make sure you hit the “Raw” button first and then copy from there. You can go directly to it here:

https://raw.githubusercontent.com/Crewski/HANotify/master/fcm-android.py

Whoops. Yeah that would explain it. Fixed.

Thanks!

Does anyone else have the issue of notifications taking ages to come through unless turning screen on? I have optimization turned off for this app on Samsung S8+ but it seems something is keeping it asleep.

Hi, great work!

Is there any action I can do on the android client ?

Such as opening other application or URL ? This will be useful in case of video clips for instance when movement is detected.

Thanks
Claudio.

Hi Guys,

Anyone had the luck creating a response automation where you can disarm the alarm?

Tried with this:

  action:
    - service: alarm_control_panel.alarm_disarm
      entity_id: alarm_control_panel.house
      data:
        code: !secret alarmcode

… but doesn’t work.

Help!

hi,

I have the same issue as previously describe but it does not go away:

ERROR (Thread-20) [custom_components.notify.fcm-android] Error sending message. Response 400: Bad Request:

NoneType: None

I know this is an older post. But would you be able to give an example for multiple actions? using JSON?

Try this:

{
"title":"Maison Degringolade",  
"message": "Anne has arrived home",
  "data": {
    "actions": [
      { "action": "open_door", "title": "Open door" },
      { "action": "close_door", "title": "Close door"},
      { "action": "turn_off_lights", "title": "Turn off Lights"}
    ]
  }
}
2 Likes

@Crewski hey why i dont get snapshot on notifications:

Is you image accessible from anywhere? As in if you type it into a web browser you’ll see the image?

Only at home. But I want on tablet that is always home. Or can I use dynamic notification, it work everywhere on ios? https://www.home-assistant.io/docs/ecosystem/ios/notifications/content_extensions/

love this addon, but getting anxious with home assistant dropping support for the way the custom component folder was organized previously.

i tried renaming the file to notify.py and putting in the folder fcm-android, However it isn’t working. I am not too keen on python to edit the file myself.

I’m having the same issue as @warcanoid , I can’t get the camera snapshot tagged in as an image. I can get the url to work in chrome, so it appears to be working.
I was also able to the camera snapshot working in the nfandroidtv platform, it has a slightly different setup for authentication tho:
{
“data”: {
“file”: {
“auth”: “digest”,
“password”: “yyyyyyy”,
“url”: “http://MYIP/Streaming/channels/1/picture”,
“username”: “xxxxx”
}
},

Is there a way to do something similar instead of the way @warcanoid was trying? Would prefer to avoid saving the snapshots locally if possible.

@BCrippsy38 have it working:

  • alias: snap
    trigger:
    platform: state
    entity_id: binary_sensor.d_link_senzor
    to: ‘on’
    action:
1 Like

@warcanoid , so do you just overwrite the file everytime the automation is triggered?
I was hoping to get around saving files since ppl have needed to add in delays allowing enough time to save before sending. But if that’s the only option I can live with it.

Thanks @warcanoid

It overides it automatically. Don’t need delay for saving, it works without

But I have problem not getting notifications when device is sleeping after 30min

@warcanoid sounds like your WiFi settings, try keeping WiFi always on. Also try forcing message_type to notification to give it priority.

Wifi is always on! Forcing message_type? How?