Historical events displayed in a label

Is there a way to capture on a daily basis the number of times a door was opened and display this value in label, then reset the next day.

Also could you keep track on a weekly basis the number of times a motion sensor was triggered between times n and y and show the average number ?

Thinking a little more about this, I would need to be able to change the variable, via a script when the motion sensor is triggered. So far I have not been able to find a way to create an event when the status of a device changes. Is this even possible?

I don’t think you’ll be able to do this reliably with HR. I think the problem would be missed/lost events if HR is not running and synchronizing between multiple instances.

I tried making a counter for “total lights on” with webcore and smartthings. I didn’t get it working how I wanted but, I also didn’t spend much time trying. I’ll probably revisit this now that I have moved over to Hubitat.

What Hub are you using? Maybe you can do it on the hub…

I’m using SmartThings as my HUB. I though about webCore, it seems like it could create a counter, however I want to keep the number of services to a minimum as the solution will be for a friend. I don’t want to reply on multiple products integrating.

My assumption is that this solution will run HA on a tablet 24/7 as a monitoring station. If its restarted, so be it.

What about creating a dedicated plugin for HA? Could the plugin use the onPoll() to keep a running count of the number of times motion was detected, then update a virtual device variable and tie this to a label to display in the GUI?

I am new to plugins so not even sure who to write one that would monitor one motion sensor.

Exactly as @Jdamore said, you would never be able to do this reliably with HR. Its connections terminate as soon as the screen turns off or you switch to another app. It would be very difficult to get this working in Plugin too. You’d have to start from scratch. Plugin instances are isolated so you wouldn’t be able to access anything from the HR SmartThings integration in a Plugin.

I’d do this on your hub, as a virtual device that is later accessed by HR just for display.
I consider HR a display tool, so any database work like storing or updating variables would need to be done elsewhere.

Ok, thank you for your advice. I will look into SmartThings and see if It can achieve this without using additional external tools.