Hi All, I’m trying to integrate a custom guest wifi portal into home assistant where it passes the guests name and MAC to home assistant over MQTT and then expects to see the MAC on a separate approve channel if it is allowed access.
The plan is that home assistant will send an actionable notification to our phones asking if we want to approve the device, when we press approve it triggers an automation to send the MAC address to the approve MQTT channel. The plan is to pass the MAC through the action data parameter so the workflow can handle multiple guest requests simultaneously.
The approve button is triggering the event in Home Assistant but there is no actionData or similar in trigger.event.data
The automations
- id: '201801181845'
alias: 'Guest requesting access'
trigger:
platform: state
entity_id: sensor.mac_requesting_access
condition: []
action:
- service: notify.all_mobiles
data:
message: >
{{ states('sensor.guest_requesting_access') }} is asking to join the network
data:
push:
category: "guestaccess" # Needs to match the top level identifier you used in the ios configuration
action_data:
mac_address: "12:34:56:78:90:AB"
# Anything passed in action_data will get echoed back to Home Assistant.
- id: '201801181942'
alias: 'Approve guest access'
trigger:
platform: event
event_type: ios.notification_action_fired
event_data:
actionName: 'GRANT_ACESS'
condition: []
action:
# - service: mqtt.publish
# data_template:
# topic: "home/network/guest/approve"
# payload: '{{ trigger.event.data["actionData"]["mac_address"] }}'
- service: persistent_notification.create
data_template:
message: "Guest access approved: {{trigger.event.data}}"
title: 'Access Approved'
What is printed in the persistent notification is:
Guest access approved: {'actionName': 'GRANT_ACESS', 'sourceDeviceName': 'iPhone', 'sourceDevicePermanentID': '6C10B223-A539-44DB-8E21-771C323XXXXX'}
iOS component configuration:
ios: # Enable the iOS (Apple not Cisco) component
push:
categories:
- name: guestaccess
identifier: 'guestaccess'
actions:
- identifier: 'GRANT_ACESS' #(Required) A unique identifier for this action. Must be uppercase and have no special characters or spaces. Only needs to be unique to the category, not unique globally.
title: 'Grant Access' # The text to display on the button. Keep it short.
activationMode: 'background' # (Optional): The mode in which to run the app when the action is performed. Setting this to foreground will make the app open after selecting. Default value is background.
authenticationRequired: no # (Optional): If a truthy value (true, True, yes, etc.) the user must unlock the device before the action is performed.
destructive: no # (Optional): When the value of this property is a truthy value, the system displays the corresponding button differently to indicate that the action is destructive (text color is red).
behavior: 'default' # (Optional): When textInput the system provides a way for the user to enter a text response to be included with the notification. The entered text will be sent back to Home Assistant. Default value is default.