Virtual sensor for duration/time

Use this forum to discuss possible implementation of a new feature before opening a ticket.
A developer shall edit the topic title with "[xxx]" where xxx is the id of the accompanying tracker id.
Duplicate posts about the same id. +1 posts are not allowed.
Post Reply
jeroenb42
Posts: 1
Joined: Wednesday 09 May 2018 10:36
Target OS: Raspberry Pi
Domoticz version:
Contact:

Virtual sensor for duration/time

Post by jeroenb42 » Wednesday 09 May 2018 10:43

I am looking for a virtual sensor which can track duration/time. I want to track how long certain devices are on/in use. I have implemented a way to test whether these devices are on in another sensor and I would like to record how long these devices are on each day. I have been able to implement this by creating a dummy text sensor and every minute a script runs to check on the devices needed and updates these text sensors. It works but the two main drawback are that the log is useless and that you cannot easily compare it to a value (unless parsing it). It shows an update every minute the device is on but I would rather see a line graph which shows an increase when the device is on (time on is increasing) and a flat line if it isn't.
I know, you check this on the original device but I would like to create an alert for example if my heater is on for more than 1 hour when the temperature outside is greater than x or send an alert when minecraft has been played for more than x hours/minutes etc

freijn
Posts: 299
Joined: Friday 23 December 2016 17:40
Target OS: Raspberry Pi
Domoticz version:
Location: Netherlands Purmerend
Contact:

Re: Virtual sensor for duration/time

Post by freijn » Wednesday 09 May 2018 22:28

What about this:

Increment a counter on the every minute check.

User avatar
Denny64
Posts: 47
Joined: Friday 03 February 2017 12:34
Target OS: Raspberry Pi
Domoticz version: 3.8153
Location: Italy
Contact:

Re: Virtual sensor for duration/time

Post by Denny64 » Thursday 10 May 2018 20:23

I think this is what you're looking for.

viewtopic.php?f=61&t=18848

It works great.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests