Irrigation-V5 icon indicating copy to clipboard operation
Irrigation-V5 copied to clipboard

Program not Triggering on Schedule

Open johnbrito2 opened this issue 1 year ago • 8 comments

Issue: Scheduled Trigger Not Working

Description: My irrigation program has not triggered automatically in weeks. The schedule counts down to the trigger time, but nothing happens when the time is reached.

Details:

Irrigation Controller Version: 5.4.15 Home Assistant Core Version: 2024.5.4 Expected Behavior: The irrigation system should start automatically at the scheduled time.

Actual Behavior: The countdown completes, but the irrigation system does not start.

Steps Taken:

Checked the logs for any error messages (none found). Restarted the Home Assistant core and reinstalled the irrigation controller. Verified the schedule settings are correct. Tested manual trigger, which works fine. screenshot

johnbrito2 avatar May 22 '24 12:05 johnbrito2

Hi, config looks fine, and it should never end up with next run being in the past. I will look into this. What hardware/OS are you running on?

Cheers Pete

petergridge avatar May 23 '24 04:05 petergridge

How are you determining the adjuster value?

petergridge avatar May 23 '24 04:05 petergridge

Also do you have any other programs defined? i.e. is there another program kicking in with the same start time?

petergridge avatar May 23 '24 04:05 petergridge

One more comment, Thanks for a great error report

petergridge avatar May 23 '24 05:05 petergridge

Hi, config looks fine, and it should never end up with next run being in the past. I will look into this. What hardware/OS are you running on?

Cheers Pete

Thank you for the quick response. I’m running Generic x86-64 on a Nuc. Just one program one zone at the moment, planning to add another zone when we get the bug resolve. For the adjuster value I’m using the OWM history integration with the Factor utilizing forecast rain and probability of precipitation template.

Thank you!

johnbrito2 avatar May 23 '24 17:05 johnbrito2

Hi, I have not had any luck replicating this issue.

I have changed some code from using the HomeAssistant Util libraries to using standard Python, it should not make a difference but it could be an issue between running on HA OS v on the NUC. But I am just guessing.

I will publish an Alpha version with some debug messages to try and determine where in the code this is happening.

petergridge avatar May 29 '24 02:05 petergridge

Hi, I have released 5.4.16-alpha as a beta in HACS.

If you turn debugging on you will get some outputs in the Log that will help me debug. https://github.com/petergridge/Irrigation-V5#debug

Cheers Pete

petergridge avatar Jun 05 '24 23:06 petergridge

Hi Pete, I have the same issue this summer. Last year it worked smoothly but now (I guess after some updates of HA and your component) the automation doesn't work anymore. Same behaviour as described above, the countdown completes, but the irrigation doesn't start. When I manually start the irrigation of the zone via the custom card it works.

In the logs I found this at exactly the time when the program should begin:

Logger: homeassistant
Source: util/dt.py:153
First occurred: 10:15:00 AM (2 occurrences)
Last logged: 10:15:00 PM

Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
  File "/config/custom_components/irrigationprogram/switch.py", line 697, in async_turn_on
    zones = await self.build_run_script(False)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/irrigationprogram/switch.py", line 629, in build_run_script
    if zone.should_run(self.scheduled) is False:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/irrigationprogram/irrigationzone.py", line 457, in should_run
    if dt_util.as_timestamp(self._next_run) > dt_util.as_timestamp(dt_util.now()):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/dt.py", line 153, in as_timestamp
    raise ValueError("not a valid date/time.")
ValueError: not a valid date/time.

Using V5.4.16.

Thanks for your help and effort!

jschroeter avatar Aug 13 '24 20:08 jschroeter

Hi @jschroeter

Can you share your configuration, screen shots will be fine.

petergridge avatar Aug 19 '24 08:08 petergridge

Sure, but I'm not sure what exactly will help you. So please let me know if you need more. Bildschirmfoto 2024-08-19 um 15 10 55 Bildschirmfoto 2024-08-19 um 15 11 20 Bildschirmfoto 2024-08-19 um 15 13 17

jschroeter avatar Aug 19 '24 13:08 jschroeter

Hi I have release v5.4.17 , a beta, I have changed the way I handle datetime, the HA helpers have all been changed to the datetime library. I am hoping that impacts this issue. if not I have added some addition debug statements that may assist.

petergridge avatar Aug 21 '24 08:08 petergridge

Hi Peter, just gave it a try, it failed again but with a different error:

This error originated from a custom integration.

Logger: homeassistant
Source: custom_components/irrigationprogram/irrigationzone.py:459
integration: Irrigation controller (documentation, issues)
First occurred: 11:05:00 AM (1 occurrences)
Last logged: 11:05:00 AM

Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
  File "/config/custom_components/irrigationprogram/switch.py", line 705, in async_turn_on
    zones = await self.build_run_script(False)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/irrigationprogram/switch.py", line 637, in build_run_script
    if zone.should_run(self.scheduled) is False:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/irrigationprogram/irrigationzone.py", line 459, in should_run
    if datetime.timestamp(self._next_run) >  datetime.timestamp(datetime.now()):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: descriptor 'timestamp' for 'datetime.datetime' objects doesn't apply to a 'str' object

jschroeter avatar Aug 21 '24 11:08 jschroeter

Can you run the action: image

Hopefully this fixes the problem

petergridge avatar Aug 21 '24 11:08 petergridge

Unfortunately not, same error in the log.

jschroeter avatar Aug 21 '24 12:08 jschroeter

Can you check the log for this error message: 'exception processing start time: %s', self._next_run. This will give me what value is being processed.

If you turn debugging on I can get a little more detail of the path the program has gone through to get to this point.

petergridge avatar Aug 21 '24 21:08 petergridge

Can you quickly explain how to find the debug logs? I followed the readme and added the lines to the configuration, updated the component again, restarted HA, ran the reset action. But only get the single error as before when the schedule should run.

jschroeter avatar Aug 22 '24 05:08 jschroeter

The debug statements come out in the log file, generally a blue colour. Setting -> system -> logs. then load full logs lets you see the information more clearly.

petergridge avatar Aug 22 '24 06:08 petergridge

I have found a couple of things that may help, V5.4.19 is available, I still don't know why it is not working but I found the code that it is falling over on is redundant and could be removed.

petergridge avatar Aug 22 '24 10:08 petergridge

Thanks a lot, that helped! It triggers again! But I noticed one issue and want to ask if this is related: it seems that zones I set to „off“ via the frequency as described in the readme now do run.

jschroeter avatar Aug 22 '24 11:08 jschroeter

One step forward, I will check the new issue. I'm not surprised there is a few side effects. I will take down v19 until I have fixed this issue.

petergridge avatar Aug 22 '24 11:08 petergridge

V5.4.20 uploaded that fixes the 'off' issue.

Hopefully that finishes this one off 😃, I will check this issue in the morning, please let me know how it goes.

petergridge avatar Aug 22 '24 12:08 petergridge

Now everything seems to work fine! Awesome, thanks a lot!! 👏

jschroeter avatar Aug 22 '24 13:08 jschroeter