Coder Social home page Coder Social logo

Comments (3)

EdLeckert avatar EdLeckert commented on July 20, 2024

I suspect your program start type was set to Sunset, and your current time of sunset is less than 210 minutes from midnight. I can reproduce the error with those conditions. And I suppose when you tried to set durations the start time was already in error. I can recreate that as well.

The reason a time entity is getting involved is because time.<program>_start_time gets updated when any of the start time parameters change, and it's getting set outside of the valid range for a single day. So if you need to change from a Sunset start type to Midnight, for example, set that first and then set the offset minutes. Going the other direction, you may have to reduce the minutes first. In any case, the start time needs to fit within a day at all times.

There is currently no way to set durations with the integration other than by minutes. This was by design to keep sliders and other UI components from having to show numbers that were unreasonably large and difficult to comprehend at a glance.

from hass-opensprinkler.

hplato avatar hplato commented on July 20, 2024

Thank you for the response (again!). All the offsets are all definitely set to midnight. I go through the four possible start times and check if it's a -1 and then set the offset_type to Disabled. If it's a positive number, I set offset_type to Midnight. I'm not quite sure what to do if the first value is -1, as start_time_offset_type doesn't have a disabled function. I could disable the overall program if a -1 value exists, but then it would enable the program if a positive number occurs (and I like to be able to override right on the OSP program for things like water restriction days).

I'll print out more debug before setting objects. Seems like a safer approach is to zero out the durations, then set the start time(s), then set the proper durations to avoid any intermediate math issues.

I still am a bit puzzled, as these are the program test strings that I'm using (in seconds, but they are converted to minutes in my code)

"[[210,-1,-1,-1],[600,650,1100,197,434,650,493,1550,1150,374,137]]";
Start 3:30am, and run for 122 minutes. (no where near midnight)
"[[400,800,-1,-1],[61,61,61,61,61,61,61,61,61,61,61]]";
Start at 6:40am and run for 22 minutes (I round up seconds), start at 1:20pm and run for 22 minutes

from hass-opensprinkler.

hplato avatar hplato commented on July 20, 2024

I've also noticed now that I have a lot of these errors in the logs. Is there any way to have some diagnostic information output so I can see what the actual issue is? I'm running firmware 219

2024-07-16 13:15:02.206 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 255, in _handle_refresh_interval
await self._async_refresh(log_failures=True, scheduled=True)
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 411, in _async_refresh
self.async_update_listeners()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 165, in async_update_listeners
update_callback()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1007, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1133, in _async_write_ha_state
state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1068, in __async_calculate_state
state = self._stringify_state(available)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1013, in _stringify_state
if (state := self.state) is None:
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/time/init.py", line 95, in state
if self.native_value is None:
^^^^^^^^^^^^^^^^^
File "/config/custom_components/opensprinkler/time.py", line 95, in native_value
return datetime.time(trunc(minutes / 60), minutes % 60, 0)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: hour must be in 0..23

from hass-opensprinkler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.