basbruss / adaptive-cover

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

Automation for horizontal screens from Somfy only works on HA reboot #126

Closed tobiasnorbo closed 4 months ago

tobiasnorbo commented 4 months ago

What version of Adaptive Cover are you using?

1.1.0

What version of Home Assistant are you using?

12.2

Checklist

Describe the issue

My awnings controlled by Somfy only runs this adaptive sover automation when I reboot HA. Since the minimum retractable setting is 1%, this also means, that when I reboot HA during the evening/night, then the screen opens to 1%, and I have to manually pull it back in.

Reproduction steps

  1. Reboot HA
  2. Awnings go to the setting matching current time and other settings in my integration.
  3. ...

Diagnostics dump

No response

basbruss commented 4 months ago

@tobiasnorbo try v1.1.2. Is the control toggle switch on?

tobiasnorbo commented 4 months ago

I wish I could tell you for sure, but after updating to V1.1.2, I was not able to reload the configurations.

basbruss commented 4 months ago

Any logs? Need more information to debug it.

tobiasnorbo commented 4 months ago

I Hope this helps:

TypeError: get_safe_state() missing 1 required positional argument: 'entity_id' 2024-04-28 18:56:14.523 DEBUG (MainThread) [custom_components.adaptive_cover] Finished fetching adaptive_cover data in 0.003 seconds (success: False) File "/config/custom_components/adaptive_cover/coordinator.py", line 225, in _async_update_data self.after_start_time File "/config/custom_components/adaptive_cover/coordinator.py", line 306, in after_start_time time = get_datetime_from_state(get_safe_state(self.start_time_entity)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I am not really familiar with reading these myself, so tried to delete whatever did not matter to the adaptive cover integration. I hope I added enough.

basbruss commented 4 months ago

I added a bugfix for the error you posted related to the start time entity.

tobiasnorbo commented 4 months ago

Thanks, but I am not able to load it now.

Logger: homeassistant.setup Source: setup.py:316 First occurred: 21:49:38 (1 occurrences) Last logged: 21:49:38

Setup failed for custom integration 'adaptive_cover': Unable to import component: cannot import name 'EventStateChangedData' from 'homeassistant.core' (/usr/src/homeassistant/homeassistant/core.py) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/loader.py", line 979, in async_get_component comp = await self.hass.async_add_import_executor_job( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/loader.py", line 1037, in _get_component ComponentProtocol, importlib.import_module(self.pkg_path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/importlib/init.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 1387, in _gcd_import File "", line 1360, in _find_and_load File "", line 1331, in _find_and_load_unlocked File "", line 935, in _load_unlocked File "", line 995, in exec_module File "", line 488, in _call_with_frames_removed File "/config/custom_components/adaptive_cover/init.py", line 19, in from .coordinator import AdaptiveDataUpdateCoordinator File "/config/custom_components/adaptive_cover/coordinator.py", line 16, in from homeassistant.core import Event, EventStateChangedData, HomeAssistant, State ImportError: cannot import name 'EventStateChangedData' from 'homeassistant.core' (/usr/src/homeassistant/homeassistant/core.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/setup.py", line 316, in _async_setup_component component = await integration.async_get_component() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/loader.py", line 997, in async_get_component self._component_future.result() File "/usr/src/homeassistant/homeassistant/loader.py", line 989, in async_get_component comp = self._get_component() ^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/loader.py", line 1037, in _get_component ComponentProtocol, importlib.import_module(self.pkg_path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/importlib/init.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 1387, in _gcd_import File "", line 1360, in _find_and_load File "", line 1331, in _find_and_load_unlocked File "", line 935, in _load_unlocked File "", line 995, in exec_module File "", line 488, in _call_with_frames_removed File "/config/custom_components/adaptive_cover/init.py", line 19, in from .coordinator import AdaptiveDataUpdateCoordinator File "/config/custom_components/adaptive_cover/coordinator.py", line 16, in from homeassistant.core import Event, EventStateChangedData, HomeAssistant, State ImportError: cannot import name 'EventStateChangedData' from 'homeassistant.core' (/usr/src/homeassistant/homeassistant/core.py)

basbruss commented 4 months ago

@tobiasnorbo Fixed with https://github.com/basbruss/adaptive-cover/releases/tag/v1.1.3-hotfix I added some code already to the release which only works with the future HA release

tobiasnorbo commented 4 months ago

Thanks a lot. It finally worked!Den 28. apr. 2024 kl. 22.40 skrev BasBruss @.***>: @tobiasnorbo Fixed with https://github.com/basbruss/adaptive-cover/releases/tag/v1.1.3-hotfix I added some code already to the release which only works with the future HA release

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>