Hi, how could I convert my cell phone’s “Do Not Disturb” sensor into an on and off switch?
The sensor is called:
sensor.s9_do_not_disturb_sensor
When the sensor is off, I would like the switch to go off, when it is in “priority_only” (it is called this on the history when the do not disturb mode is activated) the switch to go on.
Just create a Template Switch: Template Switch - Home Assistant
The first example in that is just what u need. Just replace the sensor with your phone DND sensor.
But it doesn’t work, when I do the validation it says:
Invalid config for [binary_sensor.template]: [switches] is an invalid option for [binary_sensor.template]. Check: binary_sensor.template->switches. (See ?, line ?).
Well, what do you want to do with it? Does the entity switch.not_distrurb_on exsists?
If not you will need to create that with an helper.
Normal usecase for this is to turn a non switch into a switch, but in general you would use automation for that and use the sensor.s9_do_not_disturb_sensor as atrigger and condition.
For example, turning on the garden light when i charge my phone wireless
but I would also like the inverse function, if I turn the input boolean on or off, the do not disturb mode on the mobile phone is activated or deactivated
Haha I am chatting with dshokouhi about that right now. I have a list of switches, selects, and numbers I made out of the sensors. Would be cool if mobile app provided those instead
A lot of the stuff done my notification command could also probably be instantiated as entities. Volumes as number entities, location update as a button etc etc.
O, thats nice. I was under the impression you needed a workaround based on previous posts about just this issue. But thanks for the correction, @dshokouhi too ofc.
I’m receving this notification in the drawer, but the state of the DND switch does not change. I have Samsung Galaxy S20+ 5G. Is Samsung compatible with ‘command_dnd’ directive, or this is only for Pixel phones? The entity sensor however, shows the state I set on the phone. But I cannot change the state back, from HA towards Samsung.
thats your sign the command did not work, please paste the YAML you used so we can see if there is an issue with it. More than likely you are following something that was before a breaking change. Make sure to check the logs to ensure the format is correct as the example up above is not.
as mentioned in my post up above this is the old format, so anything you see in this thread is out of date. Please refer to the link for the updated format.