I hope someone can help. I am new to home assistant but am nearly there in getting my doorbell project working. However, I am struggling with the concept of creating an action from the defined buttons on my iphone. So far I have managed to
Get my esp32 to send a video to the iphone.
Got dfplayer working connected to my esp32
Created buttons on my iphone notication.
So, I need to add the code to my automation and esp32 code so that when the action is pressed on the iphone it plays a dfplayer mp3.
My configuration.yaml entry for ios is
notify my iphone with live stream from camera and action on hold, to open the door
notify android (only with image, callback not working yet)
The last one, is the callback, what happend if you press open in the action.
Normally most of this could be in one autm, but I slit them up, because sometimes it hangs in a timeout and i got not notification.
- id: 'autm_ring_snapshot_slack'
alias: 'Besucher-Klingel-Snapshot-Slack'
description: ''
trigger:
- type: turned_on
platform: device
device_id: 22c7bc60925d40cb8b32e026ecc7f7f2
entity_id: binary_sensor.esp32_klingel_pin_d1
domain: binary_sensor
condition: []
action:
- service: camera.snapshot
data:
entity_id: camera.frigate_front_person_best
filename: /config/www/snapshots/klingel/klingel_{{ now().strftime("%Y%m%d-%H%M")}}.jpg
- service: camera.snapshot
data:
entity_id: camera.frigate_front_debug
filename: /config/www/snapshots/frontcam_latest_klingel.jpg
- service: notify.slack
data_template:
message: 'Jemand ist an der Tür \n <https://ha.knaak.work/lovelace/esp|Homeassistant>
\n <https://ha.knaak.work/local/snapshots/frontcam_latest_klingel.jpg|Image>
| <https://front.knaak.work/jXavSrgGOX4bH0BA9P6Oo4uIrQpbE7/mjpeg/kxZcRuJLJY/front
|Stream> '
title: ES klingelt
data:
file:
path: /config/www/snapshots/frontcam_latest_klingel.jpg
mode: single
# https://peyanski.com/alexa-and-home-assistant/
- id: 'autm_ring_alexa'
alias: Besucher-Klingel-Alexa
description: 'Let Alexa talk'
trigger:
- type: turned_on
platform: device
device_id: 22c7bc60925d40cb8b32e026ecc7f7f2
entity_id: binary_sensor.esp32_klingel_pin_d1
domain: binary_sensor
condition:
condition: state
entity_id: input_boolean.notifytoggle
state: "on"
action:
- service: notify.alexa_media_computer_buro
data:
target: media_player.computer_buro
message: Ring Ring, jemand klingelt.
data:
type: announce
method: all
- service: notify.alexa_media_stefan_s_fire_tv_cube
data:
target: media_player.stefan_s_fire_tv_cube
message: Ring Ring, jemand klingelt.
data:
type: announce
method: all
- service: notify.alexa_media_computer_kuche
data:
target: media_player.computer_kitchen
message: Ring Ring, jemand klingelt.
data:
type: announce
method: all
mode: single
- id: 'autm_ring_mobile_push_steffi'
alias: Besucher-Klingel-push-Steffi
description: 'Push Notification aufs Handy'
trigger:
- type: turned_on
platform: device
device_id: 22c7bc60925d40cb8b32e026ecc7f7f2
entity_id: binary_sensor.esp32_klingel_pin_d1
domain: binary_sensor
condition:
condition: state
entity_id: input_boolean.notifytoggle
state: "on"
action:
- service: notify.mobile_app_oneplus_a6013
data:
message: "Jemand ist an der Tür"
data:
image: "https://ha.knaak.work/local/snapshots/frontcam_latest_klingel.jpg"
- service: notify.mobile_app_oneplus_a6013
data:
message: "Es klingelt"
data:
actions:
- action: "TURN_ON_DOOR_OPENER" # The key you are sending for the event
title: "Open" # The button title
- action: "SOUND_NOT_ATHOME" # Must be set to URI if you plan to use a URI
title: " Away Message"
- action: "TURN_ON_DOOR_OPENER_TOP" # Must be set to URI if you plan to use a URI
title: "Open HomeDoor"
- action: "URI" # Must be set to URI if you plan to open an application
title: "Open Twitter"
uri: "app://com.twitter.android"
mode: single
- id: 'autm_ring_mobile_push_stefan'
alias: Besucher-Klingel-push-Stefan
description: 'Push Notification aufs Handy'
trigger:
# platform: state
# entity_id:
# - input_boolean.debuggertest
# to: "on"
- type: turned_on
platform: device
device_id: 22c7bc60925d40cb8b32e026ecc7f7f2
entity_id: binary_sensor.esp32_klingel_pin_d1
domain: binary_sensor
condition:
condition: state
entity_id: input_boolean.notifytoggle
state: "on"
action:
- service: notify.mobile_app_stefans_iphone_2
data_template:
message: Es klingelt
title: Jemand ist an der Tür
data:
push:
category: "camera" # Needs to match the top level identifier you used in the ios configuration
entity_id: camera.frigate_front_debug
mode: single
- id: 'aut_ios_callback_open'
alias: 'Besucher-Klingel-ios-callback-open-door'
description: 'Open the frontdoor if callback from ios triggerd'
trigger:
platform: event
event_type: ios.notification_action_fired
event_data:
actionName: TURN_ON_DOOR_OPENER
action:
- type: turn_on
device_id: 22c7bc60925d40cb8b32e026ecc7f7f2
entity_id: switch.esp32_frontdoor_opener
domain: switch
mode: single