I would like to change settings of my phone via automations.
For example, I’d like to turn on “Do not disturb” via my badtime automation.
Why mobile apps expose only sensors and we have no way to change phone settings?
I would like to change settings of my phone via automations.
For example, I’d like to turn on “Do not disturb” via my badtime automation.
Why mobile apps expose only sensors and we have no way to change phone settings?
iOS doesn’t give access to things like that. You can create a Shortcut using the shortcut app and invoke it through HA.
Android has these settings.
You can create a script with the yaml to toggle dnd and use this as your “switch”.
I can’t find these settings.
In the companion app settings I enabled the DND sensor, but in HA I find just a readonly sensor.
Thank you! I was not aware of Notification Commands.
However, it would be simpler to have switch entities on the mobile device, in my opinion.
You can’t have a switch if there are four possible settings.
You could have a select and a action button, but I believe the reasoning is that not everyone uses it.
So those who use it can create the select and the button themselves and a script to do send the command.
Yea this would be nice. In the meantime, you can do what you want by making the sensors into template switches, selects, etc that call the notification commands on change. Here’s a few examples from my config:
template:
- select:
# Do Not Disturb control on mike's phone
- name: Mikes phone do not disturb
state: "{{ states('sensor.mikes_phone_do_not_disturb') }}"
availability: "{{ states('sensor.mikes_phone_do_not_disturb') not in ['unk
nown', 'unavailable'] }}"
options: "{{ ['off', 'priority_only', 'alarms_only', 'total_silence'] }}"
icon: >-
{% if is_state('select.mikes_phone_do_not_disturb', 'off') %}
mdi:minus-circle-off-outline
{% else %}
mdi:minus-circle-outline
{% endif %}
select_option:
service: notify.mobile_app_mikes_phone
data:
message: command_dnd
data:
command: "{{ option }}"
- button:
# Request an updated location from a phone
- name: Mikes phone request location update
icon: mdi:crosshairs-gps
availability: >-
{{ states('device_tracker.mikes_phone') not in ['unknown', 'unavailable'
] }}
press:
service: notify.mobile_app_mikes_phone
data:
message: request_location_update
data:
priority: high
ttl: 0
switch:
- platform: template
switches:
mikes_phone_high_accuracy_mode:
value_template: "{{ is_state('binary_sensor.mikes_phone_high_accuracy_mode
', 'on') }}"
availability_template: "{{ states('binary_sensor.mikes_phone_high_accuracy
_mode') not in ['unknown', 'unavailabile'] }}"
icon_template: "mdi:crosshairs{{ '-gps' if is_state('switch.mikes_phone_hi
gh_accuracy_mode', 'on') }}"
turn_on:
service: notify.mobile_app_mikes_phone
data:
message: command_high_accuracy_mode
data:
command: 'turn_on'
turn_off:
service: notify.mobile_app_mikes_phone
data:
message: command_high_accuracy_mode
data:
command: 'turn_off'
It’s basically a DIY version of what you’re asking for. It’s a bit nicer then having a bunch of helpers and scripts though since the state of the switch/select automatically matches the state of the sensor. And if you change it then it automatically changes your phone without needing to press another button.
I basically wrapped many of the sensors provided by mobile app into template entities like this then just only use the template entities. I find this is a lot easier for writing automations around the notification commands as well since then I never have to remember any of them, I just call the correct service on my template entities.
I think this is a duplicate of my original WTH here