Pulse Counting

Posted on
Tue Jan 14, 2020 9:38 pm
farberm offline
Posts: 393
Joined: Feb 24, 2008

Pulse Counting

I am in need of some help setting up pulse counting to determine the hourly and daily water usage. I currently have a water meter that outputs 2 pulses per gallon and the output is connected to an Insteon 2450 i/O Linc. I know is is connected correctly as the light flashes when water is being used. What I would like to do is be able to set up a script to track the water usage hourly and daily and display it in a format similar to the following (see image) When entering a date it display the hourly amounts at the top graph and the daily for the month below.

I'm kind of new to using python and would need some help getting started and how to accomplish this. I have search online but did not really find anything. One option is to use Grafana but I still need to log the hourly and daily amount and store the data. That is the first part of the project. Once that is completed then I can work on the display options.

The graphic comes from a device called irrigation caddy. Mine is starting to fail and no longer reliable. I am not sure how to hack the web interface to determine how things are scripted. If someone can tell me how to do that then that would also be a solution.
Attachments
Screen Shot 2020-01-14 at 10.31.36 PM.png
Screen Shot 2020-01-14 at 10.31.36 PM.png (82.8 KiB) Viewed 3013 times

Posted on
Wed Jan 15, 2020 3:42 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Pulse Counting

I think my starting point would be the Timed Devices plugin, which has a few different device types. I think the Activity Tracker will be the one you want; one for hourly and one for daily.

Then you just need a trigger and script to store the value into a variable just before it resets, to maintain your historical data.

The Device Variable plugin will optionally collate the variables into one device for viewing in the UI.

Then either of the graphing plugins should be able to display your history for you.


Sent from my iPhone using Tapatalk Pro

Posted on
Wed Jan 15, 2020 8:02 pm
farberm offline
Posts: 393
Joined: Feb 24, 2008

Re: Pulse Counting

Thanks for your reply. I have set up two Timed devices (hourly, daily). Threshold set to 1, reset hourly or daily, off timer=0

Not sure how to go about setting up a trigger and script to store value before it resets.
I created two variablesHourlyUsage and DailyUsage

Create Schedule for every 60 min Insert Device State of Hourly Timed Device (counting) into HourlyUsage Variable

Create Schedule for every 24 hours Insert DEvice State Daily Timed Device (Counting) into DailyUsage Variable

Do you think this should work?

I should not need to reset the devices as that is handled by theTimed Devices setting correct.

Posted on
Wed Jan 15, 2020 11:36 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Pulse Counting

Great

I’ll need to be at my PC to play with the next bit I think.


Sent from my iPhone using Tapatalk Pro

Posted on
Thu Jan 16, 2020 12:26 pm
lalisingh offline
Posts: 166
Joined: Mar 27, 2007

Re: Pulse Counting

Does the activity tracker handle the case where the pulse counting device is offline or not able to upload the data?

If not the schedules will use the data from the last time the pulse counting device updated Indigo.

A timestamp of last update could solve this problem otherwise.

[url]https://www.VillageWorker.com[/url]
Extreme data analytics, Sensing, Control integration work.
Indigo • Barix • Kentix • Mobotix • Mikrotik • Apple

Posted on
Thu Jan 16, 2020 8:24 pm
farberm offline
Posts: 393
Joined: Feb 24, 2008

Re: Pulse Counting

Not sure I follow you. I agree the data will be impacted when the device is offline etc. how do you propose to,use time stamp?

Posted on
Fri Jan 17, 2020 3:43 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Pulse Counting

Ah, I thought that previous post was by the OP, which confused me.

Given how Indigo is reading the pulses, it’s impossible to know whether the pulse device is “offline” or water is just not being used at that time.

Back to the earlier question you’ll need multiple variables to store hour1, hour2, hour3 etc up to 24 hours. I can’t recall if there a trigger for “when activity timer restarts” so you don’t need a separate hourly schedule.


Sent from my iPhone using Tapatalk Pro

Posted on
Sat Jan 18, 2020 1:47 pm
farberm offline
Posts: 393
Joined: Feb 24, 2008

Re: Pulse Counting

Here is a screen shot of my timed variable. Similar for both. Not sure this is how it is supposed to be set up but its not really doing what I thought it should do.

What I want it to do....
Starting at 12:00 am track how many pulses are received each hour for the next 24 hour. Sum up the pulses for each day. Thus track pulses per hour and pulses per day. Once I have those going then use Grafana to display hourly, daily usage in graphic format.

Right now the timers only start one they receive a pulse, not every hour). Not sure if I have then set up correctly? Once a pulse is received they start the count down of one hour. So if a pulse is received in the middle of an hour 8:36 for instance the time runs till 9:36. Not what I want.
Attachments
Screen Shot 2020-01-18 at 2.39.04 PM.png
Screen Shot 2020-01-18 at 2.39.04 PM.png (129.23 KiB) Viewed 2797 times

Posted on
Sat Jan 18, 2020 2:01 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Pulse Counting

I’ll be at my desk shortly to have a look.


Sent from my iPad using Tapatalk Pro

Posted on
Sat Jan 18, 2020 3:37 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Pulse Counting

I've just had a play.

The Activity Timer isn't working correctly so i've filed a bug with the author.

If you set the threshold to a high number (eg 9999) and untick "always extend" then the timer should never be extended, so should always contain an accurate count for 1 hour.

Regardless, i've also looked at the plugin store and feel there's a need for a generic counting plugin that achieves what you're after, to handle all the other bits. I'm interested in writing it, but it may be a week or three before I get to it at the moment.

Peter

Posted on
Thu Jan 30, 2020 7:53 pm
farberm offline
Posts: 393
Joined: Feb 24, 2008

Re: Pulse Counting

That would be great if you could write the new plug-in
System still now counting pulses correctly etc.

Any other suggestions?

Posted on
Thu Jan 30, 2020 11:47 pm
kw123 offline
User avatar
Posts: 8366
Joined: May 12, 2013
Location: Dallas, TX

Re: Pulse Counting

the "old" indigoplotd plugin does all kinds of counting

counts/hour /day... with budget multiplier etc and then you can also plot it. Some folks have been using it to count and display for some time to for water and gas usage.

Karl

Posted on
Thu Feb 06, 2020 9:28 pm
vtmikel offline
Posts: 645
Joined: Aug 31, 2012
Location: Boston, MA

Re: Pulse Counting

The grafana plugin could also likely calculate and visualize it.

Posted on
Mon Apr 20, 2020 10:07 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Pulse Counting

viewforum.php?f=333

The plugin isn't there yet, but will hopefully have it up this week.

Posted on
Mon Apr 20, 2020 12:48 pm
farberm offline
Posts: 393
Joined: Feb 24, 2008

Re: Pulse Counting

thx

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 17 guests