Hey everyone, I wanted to share my experience with setting up doorbell history tracking. It’s been a journey, but I managed to find a workaround that works for me, though I’m open to better solutions!
My Goal: I wanted to keep track of when my front doorbell was pressed, especially when I’m away for extended periods. Knowing when someone rang the bell can be super helpful, whether I’m on vacation or just curious about who might have stopped by.
My Solution: After some research, I found that I could create a ‘history item’ that logs each press of the doorbell. I set up a rule that updates this history item with the time and date whenever the doorbell is pressed. Here’s a snippet of the rule I created:
// ***************************
// Doorbell History Update
// ***************************
rule “Doorbell History Update”
when
Item Doorbell changed from OFF to ON
then
postUpdate(Doorbell_History, "Doorbell - " + Doorbell.lastUpdate.toDateTime.toString(“dd-MM-yy HH:mm”))
end
This rule captures the timestamp and updates the history item each time the doorbell rings. I also created another rule to maintain a list of the last 10 events, which helps me see the most recent activity without scrolling through too much history.
Limitations: While this setup works, it has some drawbacks. For instance, it only captures the last 10 events, and if I wanted to track history over several weeks, I’d need a lot more items and rules. It feels a bit like a hack rather than a seamless solution.
Desire for Improvement: I think leveraging persistence would be a better approach. I use InfluxDB for data storage and Grafana for visualization, but I haven’t figured out how to display historical events in a simple list format within Grafana. It seems like Grafana is more geared towards graphs and trends rather than raw data lists. If anyone has experience with this or knows of a better way to track and display past events, I’d love to hear your thoughts!
Conclusion: Overall, I’m happy with the workaround, but I’m excited to explore more efficient solutions. It’s been a great learning experience, and I hope sharing this helps others who might be looking to achieve similar functionality.
Thanks for reading, and I’m open to any suggestions or feedback!