Sonos Notify component for homeassistant
This is a custom component to use sonos speakers with the notifier plattform of Homeassistant instead of writing custom scripts. E.g. it enables us to user the alert functionality
By the way: It is using the first tts plattform that is found - I'm currently using VOICERSS (and it's not tested with any other tts plattform)
Use copy the repo to the custom_components folder of your config folder. See also [https://developers.home-assistant.io/docs/en/creating_component_loading.html]
Then edit your configuration and add notify entities to your configuration.yaml
notify:
- name: Desk
platform: sonos_tts
entities: media_player.desk
tts: google_translate
- name: Bedroom
platform: sonos_tts
entities: media_player.bedroom
- name: SomePlayers
platform: sonos_tts
entities:
- media_player.desk
- media_player.bedroomFinally you can send notifications
# Example configuration.yaml entry
alert:
garage_door:
name: Garage is open
done_message: Garage is closed
entity_id: input_boolean.garage_door
state: 'on'
repeat: 30
can_acknowledge: true
skip_first: true
notifiers:
- deskor you just send a notification in a script
....
service: notify.someplayers
5C44
data:
volume_level: 0.5
message: This is notificationThis is my first component for home assistant and even my first code written in python. So don't expect, that is all working and use it on your own risk.
- When interrupting a single playing player, the pause notification comes to late and is interpreted, that the tts output is over and the old state is restored. This does not happen if using notification group or interrupting a joined player - I didn't figured out the problem yet.