Android TV Notifications

Hi, this is my first time posting to the forums so i apologise if ive put my query in the wrong section.

I am fairly new to HASS and im not a programmer at all. I have a Sony Bravia TV which i bought about 2 months ago and i came across this https://home-assistant.io/components/notify.nfandroidtv/ component. I have added it to my config, however i can’t quite work out how to get a notification to actually show on my TV. Just to begin with i was trying to get it to notify me every 30 seconds as i thought that was easy to test.

i have the following under automation, but i can’t work out how i am to pass the json attributes to the service.

  - alias: 'Test Notification'
    trigger:
      platform: time
      seconds: '/30'
    action:
      service: notify.androidtv
      data:
      title: "Home Assistant"
      message: "Home Assistant Test Message"

when using the services developer tools i can successfully get a notification to appear, i just for the life of me cannot figure out how to get it to do it from an automation. Any and all help is greatly appreciated.

Thank You

Please post your code using the preformatted text option - this preserves the formatting so we can rule that out as an issue.

To do that, simply highlight whatever code you’re posting and then press the preformatted text button in the editor. I’ve included an image so it’s easier to identify.

I hope i have editted my original post right, sorry about that.

Please, no apologies are necessary! It’s not very obvious and I had a lot of trouble when I started posting code so I made that image to help people out.

Did you end up figuring it out?

I have a play for 10min tonight but couldn’t get it working but I’ll spend more time on it tomorrow

For my part, I just installed Pushbullet on my AndroidTV (ShieldTV 2017) because I use it for everything else.

I haven’t set it up on the Shield yet but when I do I will report back here if you want.

Stupid question alert, but do you actually need to have the android app (Notifications for Android TV) installed on your tv too?!

I don’t think it is clear from the components page that the app needs to be installed!!

Edit: also should your automations service not be named “notify.nfandroidtv

- alias: 'Test Notification'
    trigger:
      platform: time
      seconds: '/30'
    action:
      service: notify.nfandroidtv
      data:
      title: "Home Assistant"
      message: "Home Assistant Test

I’m almost positive that you do. I know I had to install Pushbullet to the Shield.

BTW, you can install this from the web version of the Play store and just select your AndroidTV device.

1 Like

Yes, the app has to be installed on the TV. Otherwise there would be no target for HASS to deliver the notifications to. Android TVs don’t have an integrated notification-service which can be called through an API. Hence the app that provides this functionality.

Regarding configuration:
First the notification-platform has to be configured on it’s own. Much like with most of the other notification platforms. Based on what’s described in the documentation it should look something like this:

notify:
- platform: nfandroidtv
  name: Kitchen
  host: 192.168.1.12

And then the automation from above would look like this:

- alias: 'Test Notification'
    trigger:
      platform: time
      seconds: '/30'
    action:
      service: notify.Kitchen
      data:
      title: "Home Assistant"
      message: "Home Assistant Test

Mabe the notify.Kitchen has to be lower case, not sure about that. But in theory that’s how it should look like.

1 Like

I got it working last night… basic message only with notification…

I can’t seem to customize any of the duration or color with an automation… feeding the Json into dev tools it works though…

awesome, what code did you do to get it working?

I have the same issue wih my Bravia Smart TV.
@Stewface, how did you resolve the problem and could you share your notify.yaml and automation.yaml?
Also, will the notification work when TV is on standby?

Only works with the tv on… don’t have the code on me now (mobile)

hm, even with the TV on I can’t receive messages. If you can drop your code here then I can take a look at it.

Do you have an Android smartphone? Besides the “server”-app which you have installed on the TV, there also is a “client”-app for your smartphone with which you can trigger test-notifications. If those don’t work as well, the issue is outside of the scope of HASS.

I don’t have an Android phone but I do have a tablet and will try as you suggest. Although the instructions doesn’t mention anything about a client app: https://home-assistant.io/components/notify.nfandroidtv/

Because it is not needed. I only have the TV application installed as well. For testing purposes though I once had the mobile app installed, and I can imagine it would help in finding the issue you’re stuck at.

So I tested it with and Android tablet (as client app) and sending messages to my Bravia TV is no problem.

Maybe I have missed someting? This is my config:

notify.yaml:

- platform: nfandroidtv
  name: Bravia
  host: 192.168.1.32

automation.yaml:

- alias: Notify when front door is open
  trigger:
    platform: state
    entity_id: binary_sensor.door_window_sensor_158d000158511a
    - service: notify.nfandroidtv
      data:
        message: Front door is OPEN
1 Like

I assume indentation got a little messed up while copying. Proper indentation for the audomation (notice the service / action part) should look like this:

- alias: 'Notify when front door is open'
    trigger:
      platform: state
      entity_id: binary_sensor.door_window_sensor_158d000158511a
      to: 'on'
    action:
      service: notify.Bravia
      data:
        title: "Home Assistant"
        message: "Front doof is OPEN"

I’ve also added the “to” to the state of the trigger. Otherwise you would also receive the message when the door closes.
And most importantly: the service is not notify.nfandroidtv but instead notify.bravia, since that’s how you’ve named the service.

To generally make sure HASS is capable of notifying your TV:

  1. Open the HASS UI
  2. Go to the services overview (the remote control icon)
  3. Select the Domain notify
  4. Select Service bravia
  5. Enter a random message like {"message":"test"}
  6. Click the call service button. This should raise the notification on the TV.
1 Like

Thnx! You were right about the indentation. (Sometimes yaml is really picky). I’ve corrected the automation.yaml like you suggestted and now it works.

1 Like