kloggy / HA-Irrigation-Version2

225 stars 55 forks source link

Minutes for the zone watering time during the last run can get rounded up #15

Closed ToastedTortilla closed 4 years ago

ToastedTortilla commented 4 years ago

In the 'Details of Last Run', the watering time for a given zone will round up the minutes for certain durations. This mostly happens when using the weather multipliers since the zone durations won't be full minutes.

In item_status_last_run_line.yaml, the toFixed() function in var minutes = (total_seconds / 60).toFixed(); will round instead of truncating.

For example, 294 seconds gets displayed as 5' 54" instead of 4' 54" since 4.9 minutes gets rounded up to 5 by toFixed(). The time shown for the 'Total watering time last run' that includes all zones is accurate though.

Using something like var minutes = Math.floor(total_seconds / 60); seems to do the trick.

kloggy commented 4 years ago

That makes perfect sense so I'll include that change without testing it. (It is after all, non-critical ;-) ) Thanks for that, I appreciate it.

PS. Are you using the weather adjustments? I'm curious in your experience if you are because I think they work reasonably well but I got the feeling that they weren't very well received generally. I don't mind at all because I know that is partly because it seems hard to get reliable rain data and I do call them 'experimental'. They use completely made up non-scientific algorithms to work out the adjustment :-)

ToastedTortilla commented 4 years ago

Thanks for the fix. I'm only using the rainfall adjustment for now and using rainfall data from a relatively nearby station. The rainfall data isn't perfect, but good enough to ensure that if it rained quite a bit I don't need to manually adjust or skip watering cycles, the rainfall adjustment takes care of it. I manually adjust my schedules only occasionally, so I am finding the rainfall adjustment quite useful. There are some interesting add-ons that work our evaporation rates but I found the initial setup a little too daunting so this simpler "non-scientific" system you have here is a perfect compromise for me. Thanks again for the great work.

ekkesa commented 4 years ago

I can add too - I use both the rainfall & temperature weather adjustments. The rainfall/true temperature data I pull from a weather station about 50m from my home using web-scraping.

I find them very useful - Thank you for this!

kloggy commented 4 years ago

@ToastedTortilla Yes I've seen that addon for evaporation and the author has approached me to try and integrate into my package to have as another option. I'm thinking about it but I doubt I will even begin to attempt it until the winter when my system is dormant :-)

Thanks for the update. And to @ekkesa.