Olen / homeassistant-plant

Alternative Plant component of home assistant
308 stars 23 forks source link

Plant throws error on HA 2024.2.0b0 #136

Closed hmmbob closed 8 months ago

hmmbob commented 8 months ago

Running latest beta of HA, and plant v2024.1.0:

2024-02-01 07:22:56.631 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up plant platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 326, in _async_setup_platform
await asyncio.shield(task)
File "/config/custom_components/plant/sensor.py", line 129, in async_setup_entry
pdli = PlantDailyLightIntegral(hass, entry, pintegral, plant)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/plant/sensor.py", line 579, in __init__
super().__init__(
TypeError: UtilityMeterSensor.__init__() missing 1 required keyword-only argument: 'sensor_always_available'
2024-02-01 07:22:56.648 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up plant platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 326, in _async_setup_platform
await asyncio.shield(task)
File "/config/custom_components/plant/sensor.py", line 129, in async_setup_entry
pdli = PlantDailyLightIntegral(hass, entry, pintegral, plant)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/plant/sensor.py", line 579, in __init__
super().__init__(
TypeError: UtilityMeterSensor.__init__() missing 1 required keyword-only argument: 'sensor_always_available'
2024-02-01 07:22:56.661 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up plant platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 326, in _async_setup_platform
await asyncio.shield(task)
File "/config/custom_components/plant/sensor.py", line 129, in async_setup_entry
pdli = PlantDailyLightIntegral(hass, entry, pintegral, plant)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/plant/sensor.py", line 579, in __init__
super().__init__(
TypeError: UtilityMeterSensor.__init__() missing 1 required keyword-only argument: 'sensor_always_available'
2024-02-01 07:22:56.672 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up plant platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 326, in _async_setup_platform
await asyncio.shield(task)
File "/config/custom_components/plant/sensor.py", line 129, in async_setup_entry
pdli = PlantDailyLightIntegral(hass, entry, pintegral, plant)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/plant/sensor.py", line 579, in __init__
super().__init__(
TypeError: UtilityMeterSensor.__init__() missing 1 required keyword-only argument: 'sensor_always_available'
2024-02-01 07:22:56.692 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up plant platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 326, in _async_setup_platform
await asyncio.shield(task)
File "/config/custom_components/plant/sensor.py", line 129, in async_setup_entry
pdli = PlantDailyLightIntegral(hass, entry, pintegral, plant)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/plant/sensor.py", line 579, in __init__
super().__init__(
TypeError: UtilityMeterSensor.__init__() missing 1 required keyword-only argument: 'sensor_always_available'

I think this might also cause the plant card to not render completely, but unsure (no errors in the Chrome console):

image

Olen commented 8 months ago

Would you be able to test the PR i just created?

hmmbob commented 8 months ago

Sure, give me 5min for reboot etc

hmmbob commented 8 months ago

Yes, fixed.

However, in my impatience I opened the UI before the first data was in for 2 out of 5 plants - seems a typing issue may occur:

2024-02-01 10:52:18.890 WARNING (MainThread) [custom_components.plant] Sensor sensor.hangplant_air_humidity has device class 'humidity', state class 'measurement' unit '%' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: 'unknown' (<class 'str'>)

Olen commented 8 months ago

It's a known "problem". This happens when it restores the value for some reason. I have tried about everything to get rid of the warnings, but they seem to be very persistant. Everythong should be fine as soon as it fetches a value from the source sensor.

hmmbob commented 8 months ago

Thanks for the quick fix!