I use the Last FM integration, it has the following attributes:
sensor.LastFM_userName
last_played: Led Zeppelin - White Summer (10/8/69 Playhouse Theatre)
play_count: 7432
top_played: Yoyo - Woman
friendly_name: LastFM_userName
Template for play_count:
sensor.playcount
- Platform: template
sensors:
playcount:
friendly_name: 'Play Count'
value_template: >-
{{state_attr('sensor.LastFM_userName', 'play_count')}}
Is there a way to create a template that counts playcount for today only
something like: sensor.playcount last_night() - sensor.playcount now()
Tried the below but that’s not going to work as the “state” is always a changing number
- platform: history_stats
name: "Today's Playcount"
entity_id: sensor.playcount
state: 'on'
type: count
start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
end: '{{ now() }}'
Any help will be appreciated.
Thanks.