Exploring State History for Smart Notifications

Hey everyone, I’m diving into the world of smart home automation and I’m curious about leveraging state history to create more intelligent notifications. Here’s what I’m exploring:

I have an ESPresence sensor set up to detect when my phone is near the washing machine. My goal is to send a notification to the person who was last near the washing machine when it starts running. I thought using the history_stats sensor might be the key here, but I’m running into some puzzling results.

Here’s the setup I have:
yaml
platform: history_stats
name: Rik was close to the washing machine in last hour
entity_id: sensor.espresence_rik_s_iphone
state: “zolder”
type: time
end: “{{ now() }}”
duration:
hours: 1

This sensor is supposed to track the time in minutes that my phone was near the washing machine. If it works as intended, I could use this data to trigger notifications based on who was nearby. However, when I tried using type: count, I got some odd values like 0.1, which doesn’t make much sense to me.

I’m wondering if there’s a better way to approach this. Maybe someone out there has a different strategy or insight. I’d love to hear how others have used state history creatively in their automations!

On a lighter note, I’ve also been enjoying experimenting with my Lyra speaker and exploring some Disney-themed light setups. It’s amazing how these small projects can brighten up the space!

Looking forward to hearing your thoughts and experiences!