Sonos track history available in HA?

In Homebridge Sonos (ZP) Integration, I can find such track history information at least in the log:

27.11.2020, 18:18:08 [Sonos] Sonos Wohnzimmer: set Track from “Lasst uns froh und munter sein” to “Wir schmücken unseren Weihnachtsbaum”

I searched back and forth, but was currently not able to find such information in Sonos HA integration. Is this called, pushed, stored, … anywhere in HA as well? Is it possible to get this information in HA?

The current track is available as an entity attribute. You can make a template sensor if you want to extract it.

1 Like

omg. That easy. I have to get used to all this. Works like a charme. Thank you.

  - platform: template
        friendly_name: 'Sonos Wohnzimmer History'
        value_template: '{% if is_state("media_player.sonos_wohnzimmer","playing") %}{{ state_attr("media_player.sonos_wohnzimmer", "media_channel")}} - {{state_attr("media_player.sonos_wohnzimmer", "media_artist")}} - {{state_attr("media_player.sonos_wohnzimmer", "media_title")}}{% else %}gestoppt{% endif %}'

You’re welcome. If you think that was easy, Home Assistant will fit you nicely :slight_smile:

You’re welcome. If you think that was easy, Home Assistant will fit you nicely :slight_smile:

I think so. Hopefully. :wink:

Do you have any clou, why the log is not showing all events from the entities. Saw that already several times with other ones, but face this here again. In the screenshot, you can see, that the history is completely stored and displayed in the sensor, but several/a lot of events are not shown in the log.

Is this a problem with my template sensor? Or a (known) limitation of the log?

The logbook groups by 15 minute intervals and will only show the last state of a sensor in each interval. This is to avoid e.g. a power sensor updating every 1 second to fill the entire logbook but perhaps not so useful in this situation.

I am actually not sure how you can get the list you are looking for. There is a Logbook Card but it will probably do the same thing.

Such a pity.

But as it is available “on” the sensor in the color states, it should be available anywhere as well. Perhaps anyone else has an idea to get the infos from the barchart list in a kind of a table view and not for only the last x hours.

I have a lot of sensors, where I want to have this complete history, e.g. call list, Sonos, state of devices, etc. etc.