burnacid / homey-com.burnacid.ztatz

Homey app for P1 Monitor ztatz (https://www.ztatz.nl/)
GNU General Public License v3.0
0 stars 3 forks source link

[REQ] Water usage #12

Closed llentjes closed 4 years ago

llentjes commented 4 years ago

Hi! In the latest release of P1MON it is also possible to monitor water-usage. Do you implement this also?

thanks in advance.

burnacid commented 4 years ago

I need to review it. Haven't got around to check upon the new feature. So i'll look into it when I have some spare time. Thanks for your request

burnacid commented 4 years ago

Can you please send me an export of the water API results? http://yourlinktoZTATZ/api/v1/watermeter/hour

I don't have a water meter readout to check against

llentjes commented 4 years ago

this is what is see on the page you mentioned (if you prefer a different layout, please tell me): [["2020-02-11 09:00:00", 1581408000, 4.0, 4.0, 991.136], ["2020-02-11 08:00:00", 1581404400, 9.0, 9.0, 991.132], ["2020-02-11 07:00:00", 1581400800, 41.0, 41.0, 991.123], ["2020-02-11 06:00:00", 1581397200, 4.0, 4.0, 991.082], ["2020-02-11 05:00:00", 1581393600, 0.0, 0.0, 991.078], ["2020-02-11 04:00:00", 1581390000, 0.0, 0.0, 991.078], ["2020-02-11 03:00:00", 1581386400, 0.0, 0.0, 991.078], ["2020-02-11 02:00:00", 1581382800, 0.0, 0.0, 991.078], ["2020-02-11 01:00:00", 1581379200, 0.0, 0.0, 991.078], ["2020-02-11 00:00:00", 1581375600, 0.0, 0.0, 991.078], ["2020-02-10 23:00:00", 1581372000, 0.0, 0.0, 991.078], ["2020-02-10 22:00:00", 1581368400, 0.0, 0.0, 991.078], ["2020-02-10 21:00:00", 1581364800, 9.0, 9.0, 991.078], ["2020-02-10 20:00:00", 1581361200, 47.0, 47.0, 991.069], ["2020-02-10 19:00:00", 1581357600, 0.0, 0.0, 991.022], ["2020-02-10 18:00:00", 1581354000, 1.0, 1.0, 991.022], ["2020-02-10 17:00:00", 1581350400, 0.0, 0.0, 991.021], ["2020-02-10 16:00:00", 1581346800, 0.0, 0.0, 991.021], ["2020-02-10 15:00:00", 1581343200, 0.0, 0.0, 991.021], ["2020-02-10 14:00:00", 1581339600, 0.0, 0.0, 991.021], ["2020-02-10 13:00:00", 1581336000, 0.0, 0.0, 991.021], ["2020-02-10 12:00:00", 1581332400, 0.0, 0.0, 991.021], ["2020-02-10 11:00:00", 1581328800, 0.0, 0.0, 991.021], ["2020-02-10 10:00:00", 1581325200, 0.0, 0.0, 991.021], ["2020-02-10 09:00:00", 1581321600, 0.0, 0.0, 991.021], ["2020-02-10 08:00:00", 1581318000, 1.0, 1.0, 991.021], ["2020-02-10 07:00:00", 1581314400, 80.0, 80.0, 991.02], ["2020-02-10 06:00:00", 1581310800, 0.0, 0.0, 990.94], ["2020-02-10 05:00:00", 1581307200, 0.0, 0.0, 990.94], ["2020-02-10 04:00:00", 1581303600, 0.0, 0.0, 990.94], ["2020-02-10 03:00:00", 1581300000, 0.0, 0.0, 990.94], ["2020-02-10 02:00:00", 1581296400, 0.0, 0.0, 990.94], ["2020-02-10 01:00:00", 1581292800, 0.0, 0.0, 990.94], ["2020-02-10 00:00:00", 1581289200, 0.0, 0.0, 990.94], ["2020-02-09 23:00:00", 1581285600, 0.0, 0.0, 990.94], ["2020-02-09 22:00:00", 1581282000, 0.0, 0.0, 990.94], ["2020-02-09 21:00:00", 1581278400, 29.0, 29.0, 990.94], ["2020-02-09 20:00:00", 1581274800, 47.0, 47.0, 990.911], ["2020-02-09 19:00:00", 1581271200, 33.0, 33.0, 990.864], ["2020-02-09 18:00:00", 1581267600, 6.0, 6.0, 990.831], ["2020-02-09 17:00:00", 1581264000, 14.0, 14.0, 990.825], ["2020-02-09 16:00:00", 1581260400, 12.0, 12.0, 990.811], ["2020-02-09 15:00:00", 1581256800, 1.0, 1.0, 990.799], ["2020-02-09 14:00:00", 1581253200, 5.0, 5.0, 990.798], ["2020-02-09 13:00:00", 1581249600, 1.0, 1.0, 990.793], ["2020-02-09 12:00:00", 1581246000, 4.0, 4.0, 990.792], ["2020-02-09 11:00:00", 1581242400, 3.0, 3.0, 990.788], ["2020-02-09 10:00:00", 1581238800, 3.0, 3.0, 990.785], ["2020-02-09 09:00:00", 1581235200, 5.0, 5.0, 990.782], ["2020-02-09 08:00:00", 1581231600, 1.0, 1.0, 990.777], ["2020-02-09 07:00:00", 1581228000, 16.0, 16.0, 990.776], ["2020-02-09 06:00:00", 1581224400, 0.0, 0.0, 990.76], ["2020-02-09 05:00:00", 1581220800, 0.0, 0.0, 990.76], ["2020-02-09 04:00:00", 1581217200, 0.0, 0.0, 990.76], ["2020-02-09 03:00:00", 1581213600, 0.0, 0.0, 990.76], ["2020-02-09 02:00:00", 1581210000, 0.0, 0.0, 990.76], ["2020-02-09 01:00:00", 1581206400, 0.0, 0.0, 990.76], ["2020-02-09 00:00:00", 1581202800, 0.0, 0.0, 990.76], ["2020-02-08 23:00:00", 1581199200, 3.0, 3.0, 990.76], ["2020-02-08 22:00:00", 1581195600, 54.0, 54.0, 990.757], ["2020-02-08 21:00:00", 1581192000, 0.0, 0.0, 990.703], ["2020-02-08 20:00:00", 1581188400, 7.0, 7.0, 990.703], ["2020-02-08 19:00:00", 1581184800, 25.0, 25.0, 990.696], ["2020-02-08 18:00:00", 1581181200, 44.0, 44.0, 990.671], ["2020-02-08 17:00:00", 1581177600, 3.0, 3.0, 990.627], ["2020-02-08 16:00:00", 1581174000, 7.0, 7.0, 990.624], ["2020-02-08 15:00:00", 1581170400, 0.0, 0.0, 990.617], ["2020-02-08 14:00:00", 1581166800, 32.0, 32.0, 990.617], ["2020-02-08 13:00:00", 1581163200, 37.0, 37.0, 990.585], ["2020-02-08 12:00:00", 1581159600, 3.0, 3.0, 990.548], ["2020-02-08 11:00:00", 1581156000, 9.0, 9.0, 990.545], ["2020-02-08 10:00:00", 1581152400, 4.0, 4.0, 990.536], ["2020-02-08 09:00:00", 1581148800, 22.0, 22.0, 990.532], ["2020-02-08 08:00:00", 1581145200, 12.0, 12.0, 990.51], ["2020-02-08 07:00:00", 1581141600, 16.0, 16.0, 0.303], ["2020-02-08 06:00:00", 1581138000, 0.0, 0.0, 0.287], ["2020-02-08 05:00:00", 1581134400, 0.0, 0.0, 0.287], ["2020-02-08 04:00:00", 1581130800, 0.0, 0.0, 0.287], ["2020-02-08 03:00:00", 1581127200, 0.0, 0.0, 0.287], ["2020-02-08 02:00:00", 1581123600, 0.0, 0.0, 0.287], ["2020-02-08 01:00:00", 1581120000, 0.0, 0.0, 0.287], ["2020-02-08 00:00:00", 1581116400, 0.0, 0.0, 0.287], ["2020-02-07 23:00:00", 1581112800, 41.0, 41.0, 0.287], ["2020-02-07 22:00:00", 1581109200, 0.0, 0.0, 0.246], ["2020-02-07 21:00:00", 1581105600, 2.0, 2.0, 0.246], ["2020-02-07 20:00:00", 1581102000, 77.0, 77.0, 0.244], ["2020-02-07 19:00:00", 1581098400, 0.0, 0.0, 0.167], ["2020-02-07 18:00:00", 1581094800, 1.0, 1.0, 0.167], ["2020-02-07 17:00:00", 1581091200, 8.0, 8.0, 0.166], ["2020-02-07 16:00:00", 1581087600, 1.0, 1.0, 0.158], ["2020-02-07 15:00:00", 1581084000, 1.0, 1.0, 0.157], ["2020-02-07 14:00:00", 1581080400, 1.0, 1.0, 0.156], ["2020-02-07 13:00:00", 1581076800, 1.0, 1.0, 0.155], ["2020-02-07 12:00:00", 1581073200, 1.0, 1.0, 0.154], ["2020-02-07 11:00:00", 1581069600, 1.0, 1.0, 0.153], ["2020-02-07 10:00:00", 1581066000, 0.0, 0.0, 0.152], ["2020-02-07 09:00:00", 1581062400, 1.0, 1.0, 0.152], ["2020-02-07 08:00:00", 1581058800, 1.0, 1.0, 0.151], ["2020-02-07 07:00:00", 1581055200, 1.0, 1.0, 0.15], ["2020-02-07 06:00:00", 1581051600, 1.0, 1.0, 0.149], ["2020-02-07 05:00:00", 1581048000, 1.0, 1.0, 0.148], ["2020-02-07 04:00:00", 1581044400, 1.0, 1.0, 0.147], ["2020-02-07 03:00:00", 1581040800, 1.0, 1.0, 0.146], ["2020-02-07 02:00:00", 1581037200, 0.0, 0.0, 0.145], ["2020-02-07 01:00:00", 1581033600, 1.0, 1.0, 0.145], ["2020-02-07 00:00:00", 1581030000, 1.0, 1.0, 0.144], ["2020-02-06 23:00:00", 1581026400, 1.0, 1.0, 0.143], ["2020-02-06 22:00:00", 1581022800, 1.0, 1.0, 0.142], ["2020-02-06 21:00:00", 1581019200, 1.0, 1.0, 0.141], ["2020-02-06 20:00:00", 1581015600, 1.0, 1.0, 0.14], ["2020-02-06 19:00:00", 1581012000, 1.0, 1.0, 0.139], ["2020-02-06 18:00:00", 1581008400, 1.0, 1.0, 0.138], ["2020-02-06 17:00:00", 1581004800, 1.0, 1.0, 0.137], ["2020-02-06 16:00:00", 1581001200, 1.0, 1.0, 0.136], ["2020-02-06 15:00:00", 1580997600, 1.0, 1.0, 0.135], ["2020-02-06 14:00:00", 1580994000, 1.0, 1.0, 0.134], ["2020-02-06 13:00:00", 1580990400, 2.0, 2.0, 0.133], ["2020-02-06 12:00:00", 1580986800, 6.0, 6.0, 0.131], ["2020-02-06 11:00:00", 1580983200, 7.0, 7.0, 0.125], ["2020-02-06 10:00:00", 1580979600, 1.0, 1.0, 0.118], ["2020-02-06 09:00:00", 1580976000, 1.0, 1.0, 0.117], ["2020-02-06 08:00:00", 1580972400, 3.0, 3.0, 0.116], ["2020-02-06 07:00:00", 1580968800, 88.0, 88.0, 0.113], ["2020-02-06 06:00:00", 1580965200, 1.0, 1.0, 0.025], ["2020-02-06 05:00:00", 1580961600, 0.0, 0.0, 0.024], ["2020-02-06 04:00:00", 1580958000, 8.0, 8.0, 0.024], ["2020-02-06 03:00:00", 1580954400, 1.0, 1.0, 0.016], ["2020-02-06 02:00:00", 1580950800, 1.0, 1.0, 0.015], ["2020-02-06 01:00:00", 1580947200, 1.0, 1.0, 0.014], ["2020-02-06 00:00:00", 1580943600, 2.0, 2.0, 0.013], ["2020-02-05 23:00:00", 1580940000, 1.0, 1.0, 0.011], ["2020-02-05 22:00:00", 1580936400, 1.0, 1.0, 0.01], ["2020-02-05 21:00:00", 1580932800, 2.0, 2.0, 0.009], ["2020-02-05 20:00:00", 1580929200, 7.0, 7.0, 0.007]]

burnacid commented 4 years ago

I've pushed the first test version to the app store. Since I can't test this properly can you please install the test version and check if this is as intended?

https://homey.app/a/com.burnacid.ztatz/test/

llentjes commented 4 years ago

I just installed the new app. At a first glance my findings:

I will look at the app in deeper detail. This evening.

But thanks for the quick and perfect response! (ow and, but not necessary for me: the is no financial information about the water)

burnacid commented 4 years ago

Thanks I'll look into the triggers I've spotted they are showing twice. Didn't spot the financial part but will implement it as wel. Keep you posted when I have changes.

burnacid commented 4 years ago

I've published a new version. Removed the duplicate flow cards. Added financial data. Can you please upgrade and test please

https://homey.app/nl-nl/app/com.burnacid.ztatz/ZTATZ/test/

llentjes commented 4 years ago

Hi burnacid,

I had to remove the old devices and then after adding the new card, there was also financial information about water. I looks like everything is working perfect. great job! Thanks alot. There is a 5 minute delay, but i assume this is due the way p1mon reports its data.

burnacid commented 4 years ago

The API only supplies hourly rate actually. So that is what I use. Although I check indeed every 5 minutes

llentjes commented 4 years ago

Hmm, maybe ztatz accumulates its data per hour, but your app reports each 5 minutes different (but indeed increasing) values. Is it a performance issue because you check on a 5 minutes base?

burnacid commented 4 years ago

Na it will not be that big of a deal. It's a very small http request. Compaired to electricity that the app refreshes every 10 second. The 1 extra request every 5 minutes won't be that big of a deal.

If the api maybe in the future reports it more often i'll look into changing it

llentjes commented 4 years ago

Would it be a big issue when you change the frequency in the current version to something like 1 minute (or maybe the same as the electricity)? This way I can get a faster update on my water usage.

burnacid commented 4 years ago

There is no use in getting this quicker. I can only retrieve hourly rate from the API. It would not be an performance issue when I need to increase the refresh time. But there is simply no real use.

llentjes commented 4 years ago

I guess that p1mon continiuosly updates the water-counters. just like the electricity-counters update each 10 seconds. So the watercounters don't update just after 1 hour. I guess if you update the watercounters once a minute, homey can report each minute. I would like to include a screenshot from when the water is running (taking a shower). The "waterdoorstroming" and "watermeter" are updated each 5 minutes. The use could be to monitor when showering starts, the ventilation can start. When showering stops, the heating can stop. (something like this, still experimenting with it.)

burnacid commented 4 years ago

Well you can start sending a request to ZTATZ to include the current water counter in the API. I only use the build in API data that does not contain any proper counter like electricity does. So I can't propperly collect that data

llentjes commented 4 years ago

ok. i am glad with this solution. many thanks for your work!

burnacid commented 4 years ago

Released to AppStore