light: - platform: template lights: taudio_good: friendly_name: "Notify Good" turn_on: service: squeezebox.call_method data: entity_id: media_player.squeezelite_taudio command: dmx parameters: - '0,80,0,0,80,0,0,80,0,0,80,0,0,80,0,0,80,0' turn_off: service: squeezebox.call_method data: entity_id: media_player.squeezelite_taudio command: dmx parameters: - '0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0' taudio_warn: friendly_name: "Notify Warn" turn_on: service: squeezebox.call_method data: entity_id: media_player.squeezelite_taudio command: dmx parameters: - '60,20,0,60,20,0,60,20,0,60,20,0,60,20,0' - '7' turn_off: service: squeezebox.call_method data: entity_id: media_player.squeezelite_taudio command: dmx parameters: - '0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0' - '7' taudio_alert: friendly_name: "Notify Alert" turn_on: service: squeezebox.call_method data: entity_id: media_player.squeezelite_taudio command: dmx parameters: - '80,0,0,80,0,0,80,0,0,80,0,0,80,0,0,80,0,0,80,0,0' - '12' turn_off: service: squeezebox.call_method data: entity_id: media_player.squeezelite_taudio command: dmx parameters: - '0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0' - '12' taudio_all: taudio_all: friendly_name: "TAudio Color" level_template: "{{states('input_number.taudio_l') | int(0)}}" value_template: "{{states('input_number.taudio_l') | int(0) > 0}}" color_template: "({{states('input_number.taudio_h') | int(0)}}, {{states('input_number.taudio_s') | int(0)}})" turn_on: - service: input_number.set_value data: entity_id: input_number.taudio_l value: '{{ state_attr("input_number.taudio_l","initial")|float(0) }}' - service: script.taudio_set turn_off: - service: input_number.set_value data: entity_id: input_number.taudio_l value: "0" - service: script.taudio_set set_level: - service: input_number.set_value data: value: "{{ brightness| float(0) }}" entity_id: input_number.taudio_l - service: script.taudio_set set_color: - service: input_number.set_value data: value: "{{ h }}" entity_id: input_number.taudio_h - service: input_number.set_value data: value: "{{ s }}" entity_id: input_number.taudio_s - service: script.taudio_set input_number: # The following helpers are required for the light template integration taudio_h: name: TAudio Hue min: 0 max: 360 taudio_s: name: TAudio Saturation min: 0 max: 100 taudio_l: name: TAudio Level initial: 30 min: 0 max: 255 step: 1 input_text: # The following helper is used with the announce to speaker example alert_trigger: name: "Alert Trigger Source" # The following helpers are used with the automations # to search and play music based on a query taudio_play_songs: name: "Play Songs" taudio_play_artists: name: "Play Artist" taudio_play_albums: name: "Play Album" # These scripts should be replacted into the script.yaml # if configured script: # Shared function to simplify template lights taudio_set: alias: TAudio Set RGB Color sequence: - service: squeezebox.call_method data: entity_id: media_player.squeezelite_taudio command: dmx parameters: - '{% set gain = state_attr("light.taudio_all", "brightness")|int(0) %}{% for n in range(19) %}{% if gain == 0 %}0,0,0,{% else %}{% set rgb = state_attr("light.taudio_all", "rgb_color") %}{{ (rgb[0]|int(0) * gain / 255)|round }},{{ (rgb[1]|int(0) * gain / 255)|round(0) }},{{ (rgb[2]|int(0) * gain / 255)|round(0) }},{% endif %}{% endfor %}' - "0" # Used to flash lights in service calls taudio_alert_flash: alias: taudio_alert_flash sequence: repeat: count: 10 sequence: - service: light.turn_on data: entity_id: light.taudio_alert - delay: '00:00:01' - service: light.turn_off data: entity_id: light.taudio_alert - delay: '00:00:03' notify: # A Text-To_Speech platform is required for the announce to speaker example - platform: tts name: tts_announce tts_service: tts.google_say media_player: media_player.squeezelite_taudio # These automations should be located in the automation.yaml # if configured. automation: # Eaxample TTS notify using an input text helper - id: announce_to_speaker alias: TAudio Announce trigger: - platform: state entity_id: input_text.alert_trigger action: - service: squeezebox.call_method data: command: show parameters: - 'line1: HA Announce' - 'line2: {{ states("input_text.alert_trigger") }}' - 'font: light' - 'duration: 30' entity_id: media_player.squeezelite_taudio - service: notify.tts_announce data: message: "{{ states('input_text.alert_trigger') }}" mode: single # The following automations use text helpers to search and play music - id: taudio_load_albums alias: taudio_load_albums description: '' trigger: - platform: state entity_id: input_text.taudio_play_albums condition: [] action: - service: squeezebox.call_method data: entity_id: media_player.squeezelite_taudio command: playlist parameters: - loadtracks - 'album.titlesearch={{ states(''input_text.taudio_play_albums'') }}' mode: single - id: taudio_load_artists alias: taudio_load_artists description: '' trigger: - platform: state entity_id: input_text.taudio_play_artists condition: [] action: - service: squeezebox.call_method data: entity_id: media_player.squeezelite_taudio command: playlist parameters: - loadtracks - 'contributor.namesearch={{ states(''input_text.taudio_play_artists'') }}' mode: single - id: taudio_load_songs alias: taudio_load_songs description: '' trigger: - platform: state entity_id: input_text.taudio_play_songs condition: [] action: - service: squeezebox.call_method data: entity_id: media_player.squeezelite_taudio command: playlist parameters: - loadtracks - 'track.titlesearch={{ states(''input_text.taudio_play_songs'') }}' mode: single