You may be able to get this working using Shortcuts.app’s automation > “when Phone is opened” to execute a service call or fire an event. There’s no way for the app to be notified of this otherwise.
In the Shortcuts app it’s under the “Automations” tab and then “Create Personal Automation.” There’s an “Open App” trigger there. After that you can add the Home Assistant actions (pausing your roomba and media players) by following these docs.
I’ve just tested this myself and here’s what I found. When you answer a phone call from the lock screen, it doesn’t actually open the phone app, it’s like a background process or something. But if you then tap on the Phone app and make that active on screen, your shortcut will run.
So it kinda sorta works, but maybe not quite to the level you’re wanting. iOS 14 beta added new personal automation triggers for emails and text messages in Shortcuts, but not phone calls yet. Hopefully that is next on Apple’s list…
The Android app is pretty straight forward, however, I am trying to run some automations based on in call status. Does anyone know if this sensor is available in the IOS mobile app?
alias: New Automation
description: ''
trigger:
- platform: state
entity_id: sensor.phone_name_phone_state
to: offhook
id: offhook
condition: []
action:
- service: media_player.media_pause
target:
entity_id: media_player.device
- wait_for_trigger:
- platform: state
entity_id: sensor.phone_name_phone_state
to: idle
id: idle
- service: media_player.media_play
target:
entity_id: media_player.device
mode: single
you can double check this in developer mode opening the phone state then place a phone call check to see that the state changes and what it changes to use this as your trigger
My phone is called iphone_12 but I don’t have a sensor.iphone_12_state and among the sensor I have for iphone_12, none of them contains info about offhook
Is there something I have to enable on the iOS app?
EDIT: and on the logbook I don’t have any entry about phone calls.
Three years after this was first asked. Does anybody know if this is now possible (I cannot see a way, but am hoping I’ve missed something). Would like to turn down music, TV etc and raise lighting (if dimmed for TV) when the phone rings or a call is answered/made
Actually @zacwest just confirmed the only solution would be to create a shortcut as per his earlier post in here… anyhow apparently apple provide CallKit | Apple Developer Documentation
therefore there could be some possible development of a sensor in the app.