Action notification Andorid Help!

Hi all
I really need you help to understand simthing that i missing.

i manage to recive the notification on my andorid phone and chrome (on pc) with the action button.,

How i configre the button to start the automation??

i know it’s a basic quastion but i didin’t find exapnation.

Best regards.

Clicking on the action button will fire an event called “html5_notification.clicked”, you need useact this event as a trigger in your automation.

Something like:

  - alias: 'Turn all lights off when button x pressed on notification'
    trigger:
      platform: event
      event_type: html5_notification.clicked
      event_data:
        action: name_of_your_action
    action:
      service: light.turn_off
      entity_id: group.all_lights

Hi,
thank you for the fast response!
OK…

for example:

i want that the button will turn on light switch…

the service:
message:arrived home
data:
actions:
- action: open
title: Open Home Assistant
- action: TestHTML (the automation name)
title: light on

and my automaion is:

  • id: ‘1571502483667’
    alias: TestHTML
    description: ‘’
    trigger:
    • event_data:
      entity_id: switch.kitchen_light
      event_type: html5_notification.clicked
      platform: event
      condition: []
      action:
    • alias: ‘’
      data:
      switch.kitchen_tablle:
      service: switch.turn_on

what i’m missing?

Please edit your post and format the code correctly. Just mark the code and press this button </>.

OK
did it with you code! Thank you.
i still don’y understad basic thing,
how i can “call” the service as a trigger (like i did with PushBullet),
and connect spcific notification for the automation

what i need for example is - when i arraive home (i have google location) , i will get an notification that will ask me if turn on the lights…

hope it’s not too much truble.

  • alias: ‘Turn all lights off when button x pressed on notification’

    trigger:
      platform: event
      event_type: html5_notification.clicked
      event_data:
        action: name_of_your_action
    action:
      service: switch.turn_on
      entity_id: switch.kitchen_light

Thank you!!!

I personally don’t want my system asking me whether I want to do something or not, I’d rather have it do things based on certain conditions, like e.g. turn the light on if I arrive home, but only if no one else is home. But to each his own.

You should read about automations here:

And you can find some examples here:

To do it your way, you need two automations. One to send a notification, once you arrive home, which asks if you want to turn on the lights and a second automation that will turn on the light if you press the button on the notification.

First automation to send a notification when you arrive home:

automation:
  - alias: 'Send notification to ask to turn light on when someone arrives home'
    trigger:
      - platform: state
        entity_id: group.all_devices
        to: 'home'
    action:
      service: notify.notify
      data:
        message: 'Just arrived home. Do you want to turn on the kitchen lights?'
        action: turn_lights_on   #identification of your button
        title: Yes

Second automation to turn light on if the button has been pressed.

  - alias: 'Turn all lights off when button pressed on notification'
    trigger:
      platform: event
      event_type: html5_notification.clicked
      event_data:
        action: turn_lights_on #identification of the button specified above
    action:
      service: switch.turn_on
      entity_id: switch.kichten_tablle

Maybe you need to adopt these examples a bit, I don’t work with HA automations so there are probably some errors. Just show your logs if it shouldn’t work.

Thank you again,
I alrady have a lot of automatios runnig on my system, but there somthing with thoes action notification that i don’t get,

I will try to figure it out,
I hope those examples and your great help will do the job.

:pray:

Will this work if I sent the message with pushbullet?

@nirlag
Hi, if and when you find a solution please post here the 2 automations that worked
Thanks

still working on it…
I have one that working…
(begginer work :slight_smile: )
i did that with the new user intrface

- id: '1571515998934'
  alias: Ask lights on
  description: ''
  trigger:
  - entity_id: device_tracker.google_maps_
    event: enter
    platform: zone
    zone: zone.home
  condition: []
  action:
  - data:
      data:
        actions:
        - action: open
          title: Open Home Assistant
        - action: Test<==== your automation
          title: 'Yes'
      message: Welcome, Turn on lights?
    service: notify.notify <= 


Hi

Finally! i did that!
thank you,

I have one automation that works great.

now…
i have a problem that the new trigger call -html5_notification.clicked-
two times- one for each automation…
(first turn on the lights- after that triger the "good night"automation that closing everthing)
how can i direct each one?

and another quastion- how can i triger “not home” by location for spcific 3 devices i have (not all devices group)


'- id: '157151***02'
  alias: 'no one home'
  description: ''
  trigger: []
  condition:
  - condition: zone
    entity_id: device_tracker.google_maps_  **(here i want to add my devices )**
    zone: not_zone.home
  action:
  - data:
      data:
        actions:
        - action: dismiss
          title: no
        - action: automation.good_night <= (existing automation I have)
          title:yes
      message: no one home, close evrything?
    service: notify.home'

I made that with the new user inteface- I notice that output worte a bit diffrent order.

Best regards

You are almost there.

You don’t specify the automation as one of the buttons, you just specify a unique identifier like “good_night”. So change this part below:

  - data:
      data:
        actions:
        - action: dismiss
          title: no
        - action: automation.good_night <= (existing automation I have)
          title:yes

To this

  - data:
      data:
        actions:
        - action: dismiss
          title: no
        - action: good_night #just put a unique name for the action here
          title:yes

The second automation waits for a button being pressed on a notification. If the action of the button (good_night in this case) matches the one specified, the automation will be fired.

  - alias: 'Turn all lights off when button pressed on notification'
    trigger:
      platform: event
      event_type: html5_notification.clicked
      event_data:
        action: good_night #unique name specified above
    action:
      service: switch.turn_on
      entity_id: switch.kichten_tablle

I don’t understand what you want to do. When do you want to start the “good night” automation, right after you returned home?

Just add one trigger for each device to your automation.

I don’t think pushbullet supports actionable notifications.

Just a tip, try to do things yourself, if you just copy code and adapt to your needs, you won’t learn anything.

I made a mess with everyhing… Ifeel so dump to not understad that!

i have 2 automation-

1- ask if turn on lights when i arraive home=> turn “interior night light”
2- when no on’s home ask if close everthing- “good night”

that what I don’t get- how the click know what automation trigger?
the click automation know how to find the right servies to run without spcific name?
if i will understand one i will get all :slight_smile:
what i have now is:

noticiation:


 alias: close all good night
  description: ''
  trigger: []
  condition:
  - condition: zone
    entity_id: device_tracker.google_maps_1130334572677052
    zone: not_zone.home
  action:
  - data:
      data:
        actions:
        - action: dismiss
          title: לא
        - action: good_night
          title: כן
      message: there no one home, close evrything?
    service: notify.lagziel_home

clicked:

alias: Good night Turn off inerior lights when button pressed on notification
  trigger:
  - event_data: []
  condition: []
  action:
  - data:
      entity_id: switch.salon_tris, switch.dining_tris,switch.livingroom_light, switch.livingroom_hall,
        switch.down_diningspot, switch.livingroom_dining,switch.kitchen_tablle,switch.kitchen_main,switch.kitchen_light
    service: switch.turn_off

now i don’t get any respones after click on notification.

For each button you want in your notification you specify ‘action’ and ‘title’. ‘title’ is the name of the button you see when you receive the notification. ‘action’ is the identifier of this button. When you press a button, an event will be triggere and this event contains the ‘action’ identifier of the button that has been pressed.
The second automation that listens for the event checks if the event contains the correct identifier.

- alias: 'Good night Turn off inerior lights when button pressed on notification'
    trigger:
      platform: event
      event_type: html5_notification.clicked
      event_data:
        action: good_night # <- here is the identifier, this automation will only fire if the 'action' in the event is 'good_night'
    action:
      service: switch.turn_off
      entity_id: switch.salon_tris, switch......

Why do you need the “dismiss” button? Should it do something as well? If it doesn’t do anything, just remove it.

man i’m going insane! :weary: m:
it’s just not working!
what am i’m doing wrong??
i deleted all and startded over by your advices…

sorry about that but you are my only hope :pray:

all what i want for now is to get notification when i arraving home. and press ‘yes’ to turn on loghts… so simple
that my code now:

alias: 'ask turn on interior lights'
  description: ''
  trigger:
  - entity_id: device_tracker.google_maps_nirlag_gmail_com
    event: enter
    platform: zone
    zone: zone.home
  condition: []
  action:
  - data:
      data:
        actions:
        - action: turn on interior lights
          title: 'Yes'
      message: Welcome, Turn on lights?
    service: notify.lagziel_home
  hide_entity: false
- alias: 'turn on interior lights'
  trigger:
    platform: event
    event_type: html5_notification.clicked
    event_data:
      action: turn on interior lights
  action:
    service: switch.turn_on
    entity_id: switch.kitchen_light

As I general rule, as soon as something contains whitespace, I put it in quotes if it’s some text to display and I replace the whitespace with _ if it’s an identifier like an entity or an action. E.g. Welcome, Turn on lights? I change to “Welcome, turn on lights?” Whitespace outside of quotes can make trouble.
I changed your action from turn on interior lights to turn_on_interior_lights, because this is probably the problem why nothing happens on a button press.

I also rearranged it a bit to make it more readable.

Try this:

- alias: 'ask turn on interior lights'
  description: ''
  trigger:
    platform: zone
    entity_id: device_tracker.google_maps_nirlag_gmail_com
    event: enter
    zone: zone.home
  action:
    service: notify.lagziel_home
    data:
      message: "Welcome, turn on lights?"
      data:
        actions:
          action: turn_on_interior_lights
          title: 'Yes'

- alias: 'turn on interior lights'
  trigger:
    platform: event
    event_type: html5_notification.clicked
    event_data:
      action: turn_on_interior_lights
  action:
    service: switch.turn_on
    entity_id: switch.kitchen_light

still no luck.

i copied you code as is.
now i even don’t get the first notification.

threre is an option that writing in the new and the old autmation inerface making a problem?

Do you get any errors in the log?

Received message for unregistered webhook 2e957f58b27bdebdfb2db79fef61a38f8df6e8ac57540aee3961e03c711c7a8d

Ok I found a typo in my first automation. Add a dash before ‘action’.

- alias: 'ask turn on interior lights'
  description: ''
  trigger:
    platform: zone
    entity_id: device_tracker.google_maps_nirlag_gmail_com
    event: enter
    zone: zone.home
  action:
    service: notify.lagziel_home
    data:
      message: "Welcome, turn on lights?"
      data:
        actions:
          - action: turn_on_interior_lights
            title: 'Yes'

The second automation can be left as is.
I set this up on my system for testing and it worked.