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

Interpolation not configurable due to missing new_range #226

Closed miezie closed 3 months ago

miezie commented 3 months ago

What version of Adaptive Cover are you using?

1.3.1

What version of Home Assistant are you using?

2024.6.3

Checklist

Describe the issue

When ticking the box for interpolation and after that wanting to configure it (adjust "bereik") I get an error.

Reproduction steps

  1. turn on "asjusted open/close positions)
  2. finalize set-up and after that try to adjust reach
  3. error pops up

Diagnostics dump

Logger: custom_components.adaptive_cover Bron: helpers/update_coordinator.py:312 integratie: Adaptive Cover (documentatie, problemen) Eerst voorgekomen: 15:28:17 (9 gebeurtenissen) Laatst gelogd: 15:30:21

Unexpected error fetching adaptive_cover data Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 312, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/adaptive_cover/coordinator.py", line 231, in _async_update_data state = self.state ^^^^^^^^^^ File "/config/custom_components/adaptive_cover/coordinator.py", line 592, in state state = self.interpolate_states(state) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/adaptive_cover/coordinator.py", line 613, in interpolate_states state = np.interp(state, normal_range, new_range) ^^^^^^^^^ UnboundLocalError: cannot access local variable 'new_range' where it is not associated with a value

basbruss commented 3 months ago

Did you try setting the interpolation values on an already set up cover? I just noticed a bug that doesn't render the correct form afterwards.

Creating a new device for adaptive cover should allow to set those settings