Feature Request

Posted on
Mon May 04, 2020 5:32 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Feature Request

Ok, the first release appears stable, and thanks to DaveL17 for beta testing and advice.

Farberm, have a look at this and see what you think.

Note I haven't coded in months yet, it does hours and days so far, but months will follow this week.

https://github.com/howartp84/Pulse-Coun ... /tag/1.0.7

Peter

Posted on
Tue May 05, 2020 4:52 am
farberm offline
Posts: 393
Joined: Feb 24, 2008

Re: Feature Request

Very nice. Testing it out now. What are the options for device settings other that hours current.

Might be night to have a dropdown menu there for options...

Installed ok no error for the first 12 hours running. Will test further.

Posted on
Tue May 05, 2020 4:55 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Feature Request

Hi

Any of the states shown on the device are valid for the displayState.

Peter


Sent from my iPhone using Tapatalk Pro

Posted on
Tue May 05, 2020 10:19 am
whmoorejr offline
User avatar
Posts: 762
Joined: Jan 15, 2013
Location: Houston, TX

Re: Feature Request

Testing Day2:
So far, I'm having fun seeing all the data I can play with. A couple thoughts, questions and suggestions....

To sync device start time with clock time: Could you add a plugin action to sync start time with clock time? Or maybe under "Edit Device Settings" an option to change the start time of the device? I'm guessing I could schedule a "Reset Counter" action to occur at midnight which would sync start time with clock time from here out?

For current and future mathematical states (average, daily high, daily low, change from previous period (hour, day, week, month), etc), I would include a description of the math in the plugin's documentation. i.e., Average Daily This Month = total count this month / day of month as a whole number. (numbers after the decimal are dropped off, no rounding, so 16.898 = 16) or whatever the formula is.

For a single day view, my preference would be to have previous 24 hours and current 24hour period displayed. It's 11am here, so on the yesterday row in the 11am column, I would have the hourMinus23 state. For 11am today I would have the hour11 state in the 11am column. Noon today "hour12" should be "0"

It looks like the hour times, "hour00, hour01, hour03, etc.," are overwritten as that hour arrives? It's 11am here, and I have yesterday's numbers in the hour12 state. So,
hour12" is roughly = hourMinus23. (+/- based on the difference of the device's start time). Personally, I would sync start time with clock time, then set all hourXX times to "0" at midnight. Another thought is either the ability to run an action prior to resetting the hourly numbers for the day or an imbedded script to dump hourly numbers for the day into a CSV file. The benefit of dumping it into a file is for additional math, graphing, looking for trends (peak times of pulses over multiple days, etc.). Like, Dave's sump pump runs more between 4-6pm every day. My network goes offline more often around 2am, etc. A script I just wrote up to dump daily numbers (by the hour) should work with your plugin how it's currently written if I run the script just before midnight. (apologies for ugly scripting, I'm not a programmer at all, but I can copy/paste the hell out of stuff).
Code: Select all
import datetime
import os.path
from os import system
 
csvFilePath = "/Users/williammoore/Dropbox/Indigo/PulseMotion.csv"
csvHeaders = "Day,Date,0000,0100,0200,0300,0400,0500,0600,0700,0800,0900,1000,1100,1200,1300,1400,1500,1600,1700,1800,1900,2000,2100,2200,2300" + "\n"

THIS_SCRIPT = 'Log PulseMotion Data to CSV file'
DAY = '{date:%a}'.format(date=datetime.datetime.now())
DATE = '{date:%Y-%m-%d}'.format(date=datetime.datetime.now())
PulseDevice = indigo.devices[1005199723]
hour00 = str(PulseDevice.states["hour00"])
hour01 = str(PulseDevice.states["hour01"])
hour02 = str(PulseDevice.states["hour02"])
hour03 = str(PulseDevice.states["hour03"])
hour04 = str(PulseDevice.states["hour04"])
hour05 = str(PulseDevice.states["hour05"])
hour06 = str(PulseDevice.states["hour06"])
hour07 = str(PulseDevice.states["hour07"])
hour08 = str(PulseDevice.states["hour08"])
hour09 = str(PulseDevice.states["hour09"])
hour10 = str(PulseDevice.states["hour10"])
hour11 = str(PulseDevice.states["hour11"])
hour12 = str(PulseDevice.states["hour12"])
hour13 = str(PulseDevice.states["hour13"])
hour14 = str(PulseDevice.states["hour14"])
hour15 = str(PulseDevice.states["hour15"])
hour16 = str(PulseDevice.states["hour16"])
hour17 = str(PulseDevice.states["hour17"])
hour18 = str(PulseDevice.states["hour18"])
hour19 = str(PulseDevice.states["hour19"])
hour20 = str(PulseDevice.states["hour20"])
hour21 = str(PulseDevice.states["hour21"])
hour22 = str(PulseDevice.states["hour22"])
hour23 = str(PulseDevice.states["hour23"])



# Check and see if the file exists. If not, create and write the headers.
if not os.path.isfile(csvFilePath):
    csvFile = open(csvFilePath, "a")
    csvFile.write(csvHeaders)

 
# Write new values to the file.
csvFile = open(csvFilePath, "a")
element = DAY + "," + DATE + "," + hour00 + "," + hour01 + "," + hour02 + "," + hour03 + "," + hour04 + "," + hour05 + "," + hour06 + "," + hour07 + "," + hour08 + "," + hour09 + "," + hour10 + "," + hour11 + "," + hour12 + "," + hour13 + "," + hour14 + "," + hour15 + "," + hour16 + "," + hour17 + "," + hour18 + "," + hour19 + "," + hour20 + "," + hour21 + "," + hour22 + "," + hour23 +  "\n"
csvFile.write(element)
 
# Close the file.
csvFile.close()



I would probably want to do a similar CSV file data dump on a periodic basis (once per week to see day-by-day pulses), (once per month to see weekly totals)

Bill
My Plugin: My People

Posted on
Tue May 05, 2020 5:07 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Feature Request

farberm wrote:
What are the options for device settings other that hours current?

Might be night to have a dropdown menu there for options...

Done in next release.


Sent from my iPhone using Tapatalk Pro

Posted on
Tue May 05, 2020 5:08 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Feature Request

Peoples thoughts on time syncing the hours, and on resetting zero at midnight?

I’ve swung both ways on it, but my ClockDisplay plugin does it so I have the code.


Sent from my iPhone using Tapatalk Pro

Posted on
Tue May 05, 2020 6:59 pm
DaveL17 offline
User avatar
Posts: 6742
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Feature Request

I think I'd prefer having the pulse periods linked to natural (local) time--i.e., reset the clock at 00:00 LTZ. I've been thinking about the periods and, if day 5 is today and day 10 is May 10, that would work for me if dayMinusX is always in relation to today (e.g., dayMinus5 is April 30).

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Fri May 15, 2020 5:49 am
farberm offline
Posts: 393
Joined: Feb 24, 2008

Re: Feature Request

Howartp:

Here is some data. I probably do not understand the dayminus01 etc. I would expect it to be the data from the prior day. In the data below you can see the data for the past several days in day 11 thru 15, I would expect similar data in the dayminus01, dayminus 02 etc. They are all zero however I would have expected dayminus01=65, dayminus02 46, dayminus03 140, dayminus04 - 252

Is this a bug or am I just misunderstanding the calculations?
Attachments
Screen Shot 2020-05-15 at 7.42.18 AM.png
Screen Shot 2020-05-15 at 7.42.18 AM.png (110.7 KiB) Viewed 3482 times

Posted on
Tue May 19, 2020 6:15 am
farberm offline
Posts: 393
Joined: Feb 24, 2008

Re: Feature Request

I would vote for time syncing and reset at midnight. Works for most things

Posted on
Sat Jul 18, 2020 4:16 pm
agame offline
Posts: 514
Joined: Jul 13, 2017
Location: Melbourne, Australia

Re: Feature Request

I'm interested if this. plugin will work for monitoring pulses from a water meter- but this thread appears to run dry and there's no link to the plugin on the 'announcement' page. Is the GitHub link earlier I n this thread worth a. shot?

Posted on
Sun Jul 19, 2020 2:01 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Feature Request

Hi

I honestly can’t remember where I’m at with this; I’ve not intentionally abandoned it!

I’ll have a look and see what my latest version is at home.

Chase me if I don’t come back to you.

Peter


Sent from my iPhone using Tapatalk Pro

Posted on
Sun Jul 19, 2020 5:29 pm
agame offline
Posts: 514
Joined: Jul 13, 2017
Location: Melbourne, Australia

Re: Feature Request

okay, thanks!
It looks like it could greatly simplify my quest to monitor output of a solar pump, using a water meter with a reed switch output.

Posted on
Sun Jul 19, 2020 8:33 pm
agame offline
Posts: 514
Joined: Jul 13, 2017
Location: Melbourne, Australia

Re: Feature Request

update: I downloaded the [only] version linked to earlier in the discussion just to give it a go!

It does look perfect for my needs (obviously will need to do some maths outside the plugin to convert to litres - but thats no drama).

Pulse triggers are being reacted to though I can confirm some odd things are going on regarding incrementing the various counts (eg data already appeared in day 20, and subsequently vanished). Its obviously an early cut so won't bore you with any detail unless you need that.

Who is online

Users browsing this forum: No registered users and 0 guests