Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ESP:
- voice_assistant:
- on_tts_end:
- - homeassistant.service:
- service: media_player.play_media
- data:
- entity_id: media_player.obyvaci_pokoj
- media_content_id: !lambda 'return x;'
- media_content_type: music
- announce: "true"
- Packages
- #slouží k uložení původní hlasitosti
- input_number:
- sonos_puvodni_hlasitost:
- name: Sonos původní hlasitost
- min: 0
- max: 1
- step: 0.01
- #slouží k uložení původní hlasitosti
- automation:
- - id: "update_sonos_volume"
- alias: "Aktualizace Sonos původní hlasitosti"
- description: "Aktualizuje input_number.sonos_puvodni_hlasitost při změně hlasitosti přehrávače"
- trigger:
- - platform: state
- entity_id: media_player.obyvaci_pokoj
- attribute: volume_level
- condition:
- - condition: state
- entity_id: assist_satellite.esp32_s3_box_3_2e8148_assist_satellite
- state: "idle" # Aktualizace probíhá pouze, když je asistent v klidu
- action:
- - service: input_number.set_value
- target:
- entity_id: input_number.sonos_puvodni_hlasitost
- data:
- value: "{{ state_attr('media_player.obyvaci_pokoj', 'volume_level') }}"
- mode: single
- - id: "zmena_hlasitosti_s3_box3"
- alias: "Změna hlasitosti ESP32 s3_box3 při asistenci"
- description: "Sniž hlasitost při poslouchání, zpracovávání a nastav na 0.25 při odpovídání"
- trigger:
- - platform: state
- entity_id: assist_satellite.esp32_s3_box_3_2e8148_assist_satellite
- to: "listening"
- - platform: state
- entity_id: assist_satellite.esp32_s3_box_3_2e8148_assist_satellite
- to: "processing"
- - platform: state
- entity_id: assist_satellite.esp32_s3_box_3_2e8148_assist_satellite
- to: "responding"
- condition: []
- action:
- - choose:
- # Pokud stav přejde do "listening" nebo "processing", ztlum na 0
- - conditions:
- - condition: template
- value_template: >-
- {{ trigger.to_state.state in ['listening', 'processing'] }}
- sequence:
- - service: media_player.volume_set
- target:
- entity_id: media_player.obyvaci_pokoj
- data:
- volume_level: 0
- # Pokud stav přejde do "responding", nastav hlasitost na 0.25
- - conditions:
- - condition: state
- entity_id: assist_satellite.esp32_s3_box_3_2e8148_assist_satellite
- state: "responding"
- sequence:
- - service: media_player.volume_set
- target:
- entity_id: media_player.obyvaci_pokoj
- data:
- volume_level: 0.35
- # Po návratu do "idle" vrať původní hlasitost
- - wait_for_trigger:
- - platform: state
- entity_id: assist_satellite.esp32_s3_box_3_2e8148_assist_satellite
- to: "idle"
- - service: media_player.volume_set
- target:
- entity_id: media_player.obyvaci_pokoj
- data:
- volume_level: "{{ states('input_number.sonos_puvodni_hlasitost') | float }}"
- mode: restart
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement