Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 106736

History of listening time to music

$
0
0

I’m trying to implement a history graph, that tells me for how long I listened to music
this year (in my case: how long spotify is in “playing” state).

To do this I wrote the following sensor in my config yaml:

- platform: history_stats
  name: Time playing Spotify (this year only)
  unique_id: xxx
  entity_id: media_player.spotify_xxx
  state: "playing"
  type: time
  start: '{{ as_timestamp( now().replace(hour=0).replace(minute=0).replace(second=0) ) - now().year }}'
  end: '{{ now() }}'

My problem with this code is, that it resets quite randomly at midnight to 0.

Does anyone have a solution to this or could me provide some help?

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 106736

Trending Articles