Drakulix / googlehome

Google Home Integration for Home-Assistant
Apache License 2.0
29 stars 3 forks source link

Feature request: Ability to toggle Do Not Disturb #5

Closed jamieshaw closed 3 years ago

jamieshaw commented 4 years ago

Previously, before authentication was required, I was polling the Do Not Disturb REST endpoint to create a switch within Home Assistant.

Is it possible to create a switch within the custom component that calls upon /setup/assistant/notifications for similar effect?

Drakulix commented 4 years ago

Yes, this should be quite easily doable.

The underlying googledevices library already offers a function to poll that: https://github.com/Drakulix/googlehome/blob/master/custom_components/googlehome/googledevices/api/cast/assistant.py#L35

One would need to add a new update_ function to query the Do Not Distrub state and add a new switch component (very similar to the sensor.py), which then needs to be initialized here.

I have personally no use and no time for this feature. But I would gladly accept a PR implementing this functionality.