HAsmartirrigation icon indicating copy to clipboard operation
HAsmartirrigation copied to clipboard

Daily adjusted run time calculation

Open freekeys opened this issue 3 years ago • 31 comments

Hello, my daily adjusted run time has been 0 for a few days now following a period of heavy rain about 4 days ago. However it was quite sunny today so I would have thought it would require some watering. My hourly adjusted run time has been above 0 all day. Could this be an issue or does this sound like normal behaviour? Thanks!

freekeys avatar Jul 01 '21 19:07 freekeys

sounds like normal behavior. Is your bucket > 0? Your daily adjusted run time (DART) will be calculated at 11PM by default and will be based on the hourly adjusted run time (average or most recent value depending on your config). the value for the DART will be subtracted from your bucket. Here is a good example of how this works: https://github.com/jeroenterheerdt/HAsmartirrigation/wiki/Example-behavior-in-a-week

jeroenterheerdt avatar Jul 01 '21 20:07 jeroenterheerdt

Thanks!

freekeys avatar Jul 03 '21 00:07 freekeys

I installed the component few days ago, but actually I'm not able to make it working. I can see that hourly_adjusted_run_time is calculated and updated (every hour), but the daily_adjusted_run_time is updated at 23PM to an high value, than after few minutes it resets to zero, so my automation (running at 7AM) never starts. Any ideas?

mvimercati avatar Jul 08 '21 12:07 mvimercati

@mvimercati I am not sure what is going on here - can you send me screenshots from the entities and their attributes?

jeroenterheerdt avatar Jul 08 '21 18:07 jeroenterheerdt

@mvimercati I am not sure what is going on here - can you send me screenshots from the entities and their attributes?

Sure, here's the plots of last day:

daily hourly immagine

As you can see at 23.00 the DART go up to 8000s, than after few seconds it seems recalculated to another value (near 8k) and than again it goes to 600 for 5-6s. After that it change again to zero, so the automation do not run (it is triggered at 7am).

Any ideas? thx

mvimercati avatar Jul 12 '21 13:07 mvimercati

thanks for sharing. The fact that DART goes from 8000+ to 600 is because you have a maximum duration set up, so that's logical. Why then the 600 seconds gets reset to 0 doesn't make sense to me. Is there anything in the logs?

jeroenterheerdt avatar Jul 12 '21 18:07 jeroenterheerdt

thanks for sharing. The fact that DART goes from 8000+ to 600 is because you have a maximum duration set up, so that's logical. Why then the 600 seconds gets reset to 0 doesn't make sense to me. Is there anything in the logs?

Thanks for your replay. Is there a specific log to check?

mvimercati avatar Jul 12 '21 19:07 mvimercati

just the general HA log - anything that's in there for Smart Irrigation?

jeroenterheerdt avatar Jul 12 '21 20:07 jeroenterheerdt

https://github.com/jeroenterheerdt/HAsmartirrigation/blob/59986e72c684fe697d6476694070daf6c1963b86/custom_components/smart_irrigation/sensor.py#L724 from here the run time is calculated... so if your bucket < 0 we do water_budget = abs(bucket_val) / self.coordinator.peak_et. also we do couple of other multiplications / divisions. Just wondering if any one of these factors is zero,so you adjusted_run_time would end up being 0 as well.

Can you also include a screenshot of the settings for base schedule index (https://github.com/jeroenterheerdt/HAsmartirrigation#sensorsmart_irrigation_base_schedule_index)? Just wondering if there is anything in there.. specifically I am looking for base_schedule_index and the highest ET value.

jeroenterheerdt avatar Jul 12 '21 20:07 jeroenterheerdt

hello i also have a feeling that after the HA update I have 7 days 0 Daily Adjusted Run Time is the problem in the update? I copied the application again I still have 0 DART

brano1990 avatar Jul 20 '21 13:07 brano1990

hello i also have a feeling that after the HA update I have 7 days 0 Daily Adjusted Run Time is the problem in the update? I copied the application again I still have 0 DART

Yes.. I was waiting to reply because I'm not sure what is happening. After an update of HA (2021.7.1) I had one correct activation of the irrigation (the Dart was set at the max allowed running time). Then I got a lot of days (maybe 7 as brano1990) with DART at zero. Bucket was about 20mm and it seems now going very slowly to zero day by day). I will update you if I understood something else, thx.

mvimercati avatar Jul 20 '21 14:07 mvimercati

so when the bucket is > 0 there is no irrigation and the netto precipitation amount per day will be subtracted from the bucket. So if the netto precipitation is 0.5 then your bucket should become 20-0.5=19.5 at 11PM that day, etc etc until the bucket <=0.

jeroenterheerdt avatar Jul 20 '21 16:07 jeroenterheerdt

Hello I have similar problems. The calculated 23:00 watering time sets itself correctly for a few seconds. Then it restarts to 0 and after 30 minutes it returns to the previous value. Earlier I noticed that after heavy rainfall the bucket did not change and stopped watering. After a manual reset, the bucket seems to work. If i call calculate_daily_adjusted_run_time manually it doesn't have this error

2021-07-16 23:00:00 ERROR (MainThread) [homeassistant] Error doing job: Future exception was never retrieved Traceback (most recent call last): File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/smart_irrigation/sensor.py", line 137, in lambda event: self._bucket_updated( # pylint: disable=unnecessary-lambda File "/config/custom_components/smart_irrigation/sensor.py", line 301, in _bucket_updated self.update_adjusted_run_time_from_event() File "/config/custom_components/smart_irrigation/sensor.py", line 275, in update_adjusted_run_time_from_event sun_rise = datetime.datetime.strptime(sun_rise, "%Y-%m-%dT%H:%M:%S.%f%z") File "/usr/local/lib/python3.8/_strptime.py", line 568, in _strptime_datetime tt, fraction, gmtoff_fraction = _strptime(data_string, format) File "/usr/local/lib/python3.8/_strptime.py", line 349, in _strptime raise ValueError("time data %r does not match format %r" % ValueError: time data '2021-07-17T02:56:23+00:00' does not match format '%Y-%m-%dT%H:%M:%S.%f%z'

SamrtI

RobinI30N avatar Jul 30 '21 06:07 RobinI30N

Ha, finally an error log! Now we can get somewhere with this. I'll look into it and see if I can make a special version for you to test.

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: RobinI30N @.> Sent: Thursday, July 29, 2021 11:31:20 PM To: jeroenterheerdt/HAsmartirrigation @.> Cc: Jeroen ter Heerdt @.>; Comment @.> Subject: Re: [jeroenterheerdt/HAsmartirrigation] Daily adjusted run time calculation (#63)

Hello I have similar problems. The calculated 23:00 watering time sets itself correctly for a few seconds. Then it restarts to 0 and after 30 minutes it returns to the previous value. Earlier I noticed that after heavy rainfall the bucket did not change and stopped watering. After a manual reset, the bucket seems to work.

2021-07-16 23:00:00 ERROR (MainThread) [homeassistant] Error doing job: Future exception was never retrieved Traceback (most recent call last): File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/smart_irrigation/sensor.py", line 137, in lambda event: self._bucket_updated( # pylint: disable=unnecessary-lambda File "/config/custom_components/smart_irrigation/sensor.py", line 301, in _bucket_updated self.update_adjusted_run_time_from_event() File "/config/custom_components/smart_irrigation/sensor.py", line 275, in update_adjusted_run_time_from_event sun_rise = datetime.datetime.strptime(sun_rise, "%Y-%m-%dT%H:%M:%S.%f%z") File "/usr/local/lib/python3.8/_strptime.py", line 568, in _strptime_datetime tt, fraction, gmtoff_fraction = _strptime(data_string, format) File "/usr/local/lib/python3.8/_strptime.py", line 349, in _strptime raise ValueError("time data %r does not match format %r" % ValueError: time data '2021-07-17T02:56:23+00:00' does not match format '%Y-%m-%dT%H:%M:%S.%f%z'

[SamrtI]https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F72595369%2F127609304-5a2c5391-cc4a-489d-8d81-acdb1bb9e633.PNG&data=04%7C01%7C%7C24966b70ead8439cdfa608d95323a515%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637632234826002149%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=b2stIFuSK0Nl4Af4uxmhkqoYlKP0NeLcnH7mIFSVobA%3D&reserved=0

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjeroenterheerdt%2FHAsmartirrigation%2Fissues%2F63%23issuecomment-889663419&data=04%7C01%7C%7C24966b70ead8439cdfa608d95323a515%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637632234826002149%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=w%2FsC0736yVihRK20pyvOePC6zOJ0qnLjuGtd%2BJtgfdI%3D&reserved=0, or unsubscribehttps://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAB6PIPUIALDSS27CI5GV5OTT2JBLRANCNFSM47VJ7ZEA&data=04%7C01%7C%7C24966b70ead8439cdfa608d95323a515%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637632234826012148%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=EdGLdqQcr4dAyckLLXq50FrMJ6eqfwenqdJPpVuvVlA%3D&reserved=0.

jeroenterheerdt avatar Jul 30 '21 14:07 jeroenterheerdt

@RobinI30N please update to 0.0.68 and see if that fixes the issue

jeroenterheerdt avatar Jul 30 '21 17:07 jeroenterheerdt

I'm sorry but I can't fix this. Immediately after reset I don't even know how to undo the version.

2021-07-30 19:37:06 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Podlewanie przód for sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 248, in async_setup result = await component.async_setup_entry(hass, self) # type: ignore File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 67, in async_setup_entry return await hass.data[DOMAIN].async_setup_entry(entry) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 140, in async_setup_entry platform = await async_prepare_setup_platform( File "/usr/src/homeassistant/homeassistant/setup.py", line 298, in async_prepare_setup_platform platform = integration.get_platform(domain) File "/usr/src/homeassistant/homeassistant/loader.py", line 499, in get_platform cache[full_name] = self._import_platform(platform_name) File "/usr/src/homeassistant/homeassistant/loader.py", line 504, in _import_platform return importlib.import_module(f"{self.pkg_path}.{platform_name}") File "/usr/local/lib/python3.8/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 975, in _find_and_load_unlocked File "", line 671, in _load_unlocked File "", line 779, in exec_module File "", line 916, in get_code File "", line 846, in source_to_code File "", line 219, in _call_with_frames_removed File "/config/custom_components/smart_irrigation/sensor.py", line 369 data["wind_speed"] = data["wind_speed"] * (4.87 / math.((67.8 * 10) - 5.42)) ^ SyntaxError: invalid syntax

RobinI30N avatar Jul 30 '21 18:07 RobinI30N

oops. not sure what happened here. Please update to 0.0.69 and try again.

jeroenterheerdt avatar Jul 30 '21 18:07 jeroenterheerdt

So far it is fine, the entity started correctly. It's 21:17 so I'll write about the action tomorrow

RobinI30N avatar Jul 30 '21 19:07 RobinI30N

Thanks!

jeroenterheerdt avatar Jul 30 '21 19:07 jeroenterheerdt

Thanks for the good job

RobinI30N avatar Jul 30 '21 19:07 RobinI30N

Explain whether it is still necessary to convert the wind speed to a height of 2 m.

Currently I'm switching to node-red from 7m to 2m. I have my own weather station

RobinI30N avatar Jul 30 '21 19:07 RobinI30N

as this page explains: https://github.com/jeroenterheerdt/HAsmartirrigation/wiki/Measurements-and-Units, you need to provide the wind speed at a height of 2m if you use your own weather station or in general do not use OWM. If you use OWM then the component does the conversion for you.

jeroenterheerdt avatar Jul 30 '21 22:07 jeroenterheerdt

There was no question. My interpretation error: I thought why is the formula executing when I have my own wind sensor? .. it was a syntax error. Currently it does not log errors, calculations look correct. Thank you!

RobinI30N avatar Jul 31 '21 07:07 RobinI30N

thanks for letting me know. @mvimercati can you please also update and confirm this fixes your issue? If so, please close the issue.

jeroenterheerdt avatar Jul 31 '21 15:07 jeroenterheerdt

@RobinI30N - if the formula is executed at least part of the data is configured to come from OWM. Is that correct or are you using another source (such as your weather station) for all of your data?

jeroenterheerdt avatar Jul 31 '21 16:07 jeroenterheerdt

For me, that probably solves the problem. There has only been one update, so it's categorically hard to say? All data comes from the weather station. I have 4 instances for 5 circuits. Additionally, I have a percentage slider for each of them to calibrate the watering time. ESP Easy works as a controller.

RobinI30N avatar Jul 31 '21 16:07 RobinI30N

thanks for letting me know. @mvimercati can you please also update and confirm this fixes your issue? If so, please close the issue.

Unfortunately (well, maybe not) I'm on holidays 'til end of month and I can't monitor HA. The irrigation is running with your extension plus 10 minuts of fixed running :)

mvimercati avatar Aug 03 '21 13:08 mvimercati

Hallo, sorry for maybe wrong question, sometimes the irrigation suddenly stops working, It was working quite good for few months, but I noticed sometimes the hourly irrigation goes mad... resets to 0 (even when is sunny) or counts big values (even when is cloudy or patrly raining)... Now current example - yesterday (16.5. at time 00:25 at night) reseted the hourly adjusted run time to 0 - whole previous day was sunny, as well is now... so for few hours is still 0 (even if it should be IMHO counting some values) can somebody plz explain where might be a mistake?

hourlytime

I have set very precisely the 30years average statistics evapotranspiration data, and I am not using any rain sensors - so variant maybe not precise enough? It is a bit wired now, since usually until the last weeks used to work almost perfectly. thx foa any clue. Willy

berkavil avatar May 16 '22 11:05 berkavil

@berkavil please open your own issue thread and capture the debug logs.

jeroenterheerdt avatar May 16 '22 17:05 jeroenterheerdt

Hallo thank you, plz how I can collect debug logs?

There is no error or any other issue mentioned in the system logs.

thx

Vilem

From: Jeroen ter Heerdt <> Sent: Monday, May 16, 2022 7:50 PM To: jeroenterheerdt/HAsmartirrigation @.> Cc: Willy @.>; Mention @.***> Subject: Re: [jeroenterheerdt/HAsmartirrigation] Daily adjusted run time calculation (#63)

@berkavil https://github.com/berkavil please open your own issue thread and capture the debug logs.

— Reply to this email directly, view it on GitHub https://github.com/jeroenterheerdt/HAsmartirrigation/issues/63#issuecomment-1127962351 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AUH5V3H3KPA5OXZTSYNNEGDVKKDDNANCNFSM47VJ7ZEA . You are receiving this because you were mentioned.Message ID: @.***>

berkavil avatar May 17 '22 06:05 berkavil