Example Automation to control the Volume of an Sonos Speaker

Example Automation to control the Volume of an Sonos Speaker
with the Ears (Volume Control) of an Toniebox

in my case I control the Volume of an IKEA Symfonisk Speaker (in theory any other MediaPlayer connected to HomeAssistant should work too)

This automation is part my Demo Video that was shown at the 37C3 Talk

This automation requiers an running “TeddyCloud” Server, at least one connected Toniebox, HomeAssistant, MQTT Connection between TeddyCloud and HA

Example Automation:

alias: Teddycloud Sonos Volume
description: ""
trigger:
  - platform: state
    entity_id:
      - event.teddycloud_box_example_volume_up
    id: example_up
  - platform: state
    entity_id:
      - event.teddycloud_box_example_volume_down
    id: example_down
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - example_up
        sequence:
          - service: media_player.volume_up
            data: {}
            target:
              entity_id: media_player.wohnzimmer
      - conditions:
          - condition: trigger
            id:
              - example_down
        sequence:
          - service: media_player.volume_down
            data: {}
            target:
              entity_id: media_player.wohnzimmer
mode: single

This automation is listening for the Events “event.teddycloud_box_example_volume_down” and “event.teddycloud_box_example_volume_up” that will be provided by TeddyCloud using MQTT