### TEMPORARY DEBUG: Family Room Show volume changes ### # Investigating volume rising near the end of songs and resetting on the next song. # Writes a Logbook entry for every volume change and every song change, with the # source of the change taken from the new state's context: # parent_id set -> an HA automation or script caused it # user_id set -> a person in HA (dashboard, app, Developer Tools) # neither -> not HA: Alexa/Amazon itself, or the integration reporting it # late (Alexa Media Player can report HA-made changes on a poll) # Remove this file once the cause is found. - id: '1793834214055' alias: DEBUG - Family Room Show volume logger description: Temporary. Logs Family Room Show volume and song changes with their source. mode: queued max: 50 triggers: - trigger: state entity_id: media_player.family_room_show attribute: volume_level id: volume - trigger: state entity_id: media_player.family_room_show attribute: media_title id: song actions: - variables: source: >- {%- set c = trigger.to_state.context -%} {{ 'HA automation/script (parent context ' ~ c.parent_id ~ ')' if c.parent_id else 'HA user ' ~ c.user_id if c.user_id else 'not from HA (Alexa/Amazon, or a late integration update)' }} position: >- {%- set pos = trigger.to_state.attributes.media_position -%} {%- set dur = trigger.to_state.attributes.media_duration -%} {{ (pos | int(0) ~ 's of ' ~ dur | int(0) ~ 's') if pos is number and dur is number else 'unknown' }} - action: logbook.log data: name: Volume debug entity_id: media_player.family_room_show message: >- {%- if trigger.id == 'volume' -%} volume {{ trigger.from_state.attributes.volume_level | default('?') }} -> {{ trigger.to_state.attributes.volume_level | default('?') }} | song: {{ trigger.to_state.attributes.media_title | default('?') }} | position: {{ position }} | state: {{ trigger.to_state.state }} | source: {{ source }} {%- else -%} song changed: {{ trigger.from_state.attributes.media_title | default('?') }} -> {{ trigger.to_state.attributes.media_title | default('?') }} | volume now: {{ trigger.to_state.attributes.volume_level | default('?') }} | source: {{ source }} {%- endif -%}