hasscc / petkit

🐱 Petkit feeder components for HomeAssistant
Apache License 2.0
119 stars 16 forks source link

Timestamp on last used? #13

Open DieterKoblenz opened 2 years ago

DieterKoblenz commented 2 years ago

Hi, wonderful project! Many thanks for making this available.

I'm trying to track my cat litterbox use, however I can't get my head around the last used sensor.

When I use: {{ as_timestamp(state_attr('sensor.t3_100006800_last_record', 'timestamp')) }}

It returns none.

Is there an easy way to get the last real usage?

al-one commented 2 years ago
{{ as_datetime(state_attr('sensor.t3_100006800_last_record', 'timestamp')) }}
DieterKoblenz commented 2 years ago

... I could've tried it myself. Okay, thank you.

However, now I'm getting the following value: 2022-03-13 16:07:22 -> which is consistent with the timestamp on the sensor: 1647187642

However, the last time it was used is around 1pm today. It shows in the history of the sensor, but apparantly the timestamp isn't updated. Or I am using it incorrect?