I use the following esphome code to display the name of the currently playing media item:
text_sensor:
- platform: homeassistant
name: "Current Media Title"
entity_id: media_player.squeezelite_lounge
attribute: media_title
id: media_title
on_value:
then:
- component.update: esp_display
This works fine.
However, if I use the command media_player.clearplaylist, the attribute media_title is removed entirely (its not set to blank/null). Because of this, esphome is never updated and still shows the (pre cleared) media title.
Ideally I’d like to fix this in esphome code, but I think I might only be able to solve this by wrapping the attribute in its own template sensor ?