basbruss / adaptive-cover

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

Crash if i add Lux entity #223

Closed garnbleiche closed 3 weeks ago

garnbleiche commented 3 weeks 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

If i add my ESPHome Lux entity the Adaptive Cover Integration crashs.

Reproduction steps

  1. Add ESPHome Lux entity
  2. Set Lux Threshold
  3. In the Integration Switch Lux Switch on

-->

Logger: custom_components.adaptive_cover
Quelle: helpers/update_coordinator.py:312
Integration: Adaptive Cover (Dokumentation, Probleme)
Erstmals aufgetreten: 13:24:00 (2 Vorkommnisse)
Zuletzt protokolliert: 13:25:45

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 225, in _async_update_data
    self.climate_mode_data(options, cover_data)
  File "/config/custom_components/adaptive_cover/coordinator.py", line 555, in climate_mode_data
    self.climate_state = round(ClimateCoverState(cover_data, climate).get_state())
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/adaptive_cover/calculation.py", line 388, in get_state
    result = self.normal_type_cover()
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/adaptive_cover/calculation.py", line 316, in normal_type_cover
    return self.normal_with_presence()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/adaptive_cover/calculation.py", line 325, in normal_with_presence
    self.climate_data.lux
  File "/config/custom_components/adaptive_cover/calculation.py", line 293, in lux
    return value <= self.lux_threshold
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: '<=' not supported between instances of 'str' and 'float'

Diagnostics dump

No response