### Send push to ios when coming home
- alias: Push when arriving home
hide_entity: true
trigger:
- platform: state
entity_id: device_tracker.nils_iphone_se
to: 'home'
action:
- service: notify.ios_nils_iphone_se
data:
message: "Arriving home"
data:
push:
badge: 5
category: "GeoLights"
### React to push reply and turn on lights
- alias: Lights on when arriving home
hide_entity: true
trigger:
- platform: event
event_type: ios.notification_action_fired
event_data:
actionName: Lights_on
action:
- service: homeassistant.turn_on
entity_id: light.livingroom_door
Once I’m changing the state from not home to home I’ll get a notification which says “Arriving home” but no button and also the HA apps shows a badge with the number of notification which I can’t get rid of.
Im looking at this now and i myself am having problems. I get the message in a notification but no button action.
Your config looks very similar to mine, the only thing i can see wrong with yours is the category identifiers and action parameter identifiers are not UPPERCASE and the documentation says that uppercase is a requirement.
This is the output from the log i have when my automation is executed:
17-01-16 20:57:57 homeassistant.components.automation: Executing Ask if to Enable Work from home
17-01-16 20:57:57 homeassistant.core: Bus:Handling <Event logbook_entry[L]: domain=automation, name=Ask if to Enable Work from home, message=has been triggered, entity_id=automation.ask_if_to_enable_work_from_home>
17-01-16 20:57:57 homeassistant.helpers.script: Script Ask if to Enable Work from home: Running script
17-01-16 20:57:57 homeassistant.helpers.script: Script Ask if to Enable Work from home: Executing step call service
17-01-16 20:57:57 homeassistant.core: Bus:Handling <Event call_service[L]: domain=notify, service_call_id=1978288752-16, service_data=data=push=category=WFH, message=Are you working from home today?, service=ios_daves_iphone>
Also badge: 5 set the app badge to 5 - seems a bit pointless really especially as you cant clear it.
@robbiet480 - is this functionality properly working in the current beta release of the iOS app?
- alias: Notify iOS app
trigger:
platform: state
entity_id: device_tracker.ryans_iphone
state: 'home'
action:
service: notify.iosapp_ryans_iphone_app
data:
message: "Something happened at home!"
data:
push:
badge: 0 # this will remove the badge/app icon number
category: 'DOOR'
action_data:
entity_id: light.test # I am no sure what this does.
Awesome - got this working also. I actually think my problem was that i hadnt updated my push settings from the app. For good measure i removed and reinstalled the app anyway as it was having problems connecting for some reason.
I also changed my name to lowercase and had no space for good measure also. Either way it works now so thanks for your help on this.
Can start having some more fun with automations now.
EDIT: Solved! I can’t believe it…
I re-read the documentation, but there doesn’t seem to be anything there about “update push settings” in the app itself after editing the config and restarting hass. I know it’s in this thread, but I missed it again.
I’ll leave this here since this config works:
(in the past…) I’ve been trying for hours and can’t figure out what I’m missing. My LIGHTS category works, but my RESTART one just sends a simple message with no actions. Please let me know what I’ve got wrong.
I thought maybe RESTART was a reserved word, but I’ve tried other things there.
ios:
push:
categories:
- name: lights
identifier: 'LIGHTS'
actions:
- identifier: 'LIGHTS_OFF'
title: 'All Lights Off'
activationMode: 'background'
authenticationRequired: no
behavior: 'default'
- identifier: 'LIGHTS_JUST_TV'
title: 'Just TV Light On'
activationMode: 'background'
authenticationRequired: no
behavior: 'default'
- name: restart
identifier: 'RESTART'
actions:
- identifier: 'RESTART_PI_HASS'
title: 'Restart HA on Pi'
activationMode: 'background'
authenticationRequired: no
behavior: 'default'
- identifier: 'RESTART_PI_SWITCH'
title: 'Have coffee'
activationMode: 'background'
authenticationRequired: no
behavior: 'default'
automation:
- alias: 'Left the Lights On'
trigger:
- platform: state
entity_id: group.all_devices
to: 'not_home'
action:
service: notify.ios_lwi6
data:
message: "The lights are on and no one's home"
data:
push:
category: 'LIGHTS'
- alias: "Restart Pi HA if Offline"
trigger:
- platform: state
entity_id: binary_sensor.pi_kitchen_hass
state: 'off'
action:
service: notify.ios_lwi6
data:
message: "Pi Home Assistant stopped running"
data:
push:
category: 'RESTART'
# ACTIONS from ios notifications
- alias: iOS action lights off
hide_entity: True
trigger:
platform: event
event_type: ios.notification_action_fired
event_data:
actionName: LIGHTS_OFF
action:
service: homeassistant.turn_off
entity_id: group.all_lights
- alias: iOS action tv light on
hide_entity: True
trigger:
platform: event
event_type: ios.notification_action_fired
event_data:
actionName: LIGHTS_JUST_TV
action:
- service: homeassistant.turn_off
entity_id: group.all_lights
- service: homeassistant.turn_on
entity_id: light.sunflower_2bd9
- alias: iOS action restart Pi hass
hide_entity: True
trigger:
platform: event
event_type: ios.notification_action_fired
event_data:
actionName: RESTART_PI_HASS
action:
service: shell_command.restart_pi_hass
- alias: iOS action something else
hide_entity: True
trigger:
platform: event
event_type: ios.notification_action_fired
event_data:
actionName: RESTART_PI_SWITCH
action:
service: homeassistant.turn_on
entity_id: switch.jug
I know this is an old thread, but just incase someone comes looking here to try and fix or work out iOS notifications, note that version 0.54 introduced a breaking change for actionable iOS notifications
Category identifiers must now all be LOWER case NOT upper as it used to be.
Action identifiers can be either upper or lower case within iOS section of config. However, they must be upper case if specified as a trigger in automations. When HomeAssistant receives the action fired event from the iPhone, the action name is automatically uppercase, regardless of whether upper or lower case was used when the actionable notification has been written under iOS section of config. If the trigger action identifier is not uppercase, the automation will not be triggered. For this reason, I’m keeping my action identifiers in upper case in both iOS and automation sections of the config.
In summary, since 0.54, category identifiers must be lower case and action identifiers are easier to keep as upper case, especially if they already are uppercase within your config. And don’t forget to update push settings in the iOS app via Settings>Notification Settings>Update Push Settings!