basbruss / adaptive-cover

An Adaptive Cover component for HomeAsisstant to control covers based on the sun's position
MIT License
90 stars 11 forks source link

Format of "Entity indicating starting time" #146

Closed swa72 closed 4 months ago

swa72 commented 4 months ago

What version of Adaptive Cover are you using?

1.1.4

What version of Home Assistant are you using?

2024.5

Checklist

Describe the issue

I have an input_datetime.cover_result helper, of type time that I would like to use as starting time, in this case 8:00 in the morning.

However, the integration reports the following. I think it expects something in date and time format. Wouldn't be a time format be sufficient?

Logger: custom_components.adaptive_cover
Source: helpers/update_coordinator.py:315
integration: Adaptive Cover ([documentation](https://github.com/basbruss/adaptive-cover), [issues](https://github.com/basbruss/adaptive-cover/issues))
First occurred: 09:10:27 (149 occurrences)
Last logged: 12:20:01

Unexpected error fetching adaptive_cover data
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 315, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/adaptive_cover/coordinator.py", line 229, in _async_update_data
    self.after_start_time
  File "/config/custom_components/adaptive_cover/coordinator.py", line 310, in after_start_time
    time = get_datetime_from_state(
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/adaptive_cover/helpers.py", line 39, in get_datetime_from_state
    return dt.datetime.strptime(state, "%Y-%m-%dT%H:%M:%S%z")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/_strptime.py", line 554, in _strptime_datetime
    tt, fraction, gmtoff_fraction = _strptime(data_string, format)
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/_strptime.py", line 333, in _strptime
    raise ValueError("time data %r does not match format %r" %
ValueError: time data '08:00:00' does not match format '%Y-%m-%dT%H:%M:%S%z'

Reproduction steps

1. 2. 3. ...

Diagnostics dump

No response

swa72 commented 4 months ago

Tried it with an input_datetime of format date and time. No luck either.