Olen / homeassistant-plant

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

Plant status unknown after upgrade to HA 2023.8 #96

Closed morris2009 closed 1 year ago

morris2009 commented 1 year ago

Hi, It appears that the main status of a plant is nog changing from unknown to any state anymore after upgrading home assistant to 2023.8 Each of the sensors of the plant do show the correct value. So they are taken correctly from the underlying physical sensors. The attributes for the main sensor for plant monitor, ing case plant.alocasia are Unknown (except species and species original) and don't get updated. The entities below are all correct and updated.

Any idea where to start looking what is wrong? Or is this a bug introduced by 2023.8?

Olen commented 1 year ago

It works fine with 2023.8 here. Do you have anything in your logs? What version are your running? Could you enable debug logging and see what happens?

morris2009 commented 1 year ago

Not really sure what i should make of the logging. I enabled debug logging, restarted HA and ended debug:

2023-08-10 20:37:46.876 DEBUG (MainThread) [custom_components.plant] Setting up config entry b48b2af5e0a6bd8d1f10faa5f411bcaf: <homeassistant.config_entries.ConfigEntry object at 0x7ffb9765f5e0>
2023-08-10 20:37:53.858 DEBUG (MainThread) [custom_components.plant.number] {'plant_info': {'name': 'Alocasia ', 'species': 'alocasia cucullata', 'temperature_sensor': 'sensor.plant_sensor_7993_temperature', 'moisture_sensor': 'sensor.plant_sensor_7993_moisture', 'conductivity_sensor': 'sensor.plant_sensor_7993_conductivity', 'illuminance_sensor': 'sensor.plant_sensor_7993_illuminance', 'search_for': 'Alocasia ', 'data_source': 'openplantbook', 'entity_picture': 'https://opb-img.plantbook.io/alocasia%20cucullata.jpg', 'display_pid': 'Alocasia cucullata', 'limits': {'max_moisture': 60, 'min_moisture': 15, 'max_illuminance': 22500, 'min_illuminance': 900, 'max_dli': 12, 'min_dli': 5, 'max_temperature': 32, 'min_temperature': 5, 'max_conductivity': 2000, 'min_conductivity': 350, 'max_humidity': 85, 'min_humidity': 30}}}
2023-08-10 20:37:54.250 DEBUG (MainThread) [custom_components.plant.sensor] {'plant_info': {'name': 'Alocasia ', 'species': 'alocasia cucullata', 'temperature_sensor': 'sensor.plant_sensor_7993_temperature', 'moisture_sensor': 'sensor.plant_sensor_7993_moisture', 'conductivity_sensor': 'sensor.plant_sensor_7993_conductivity', 'illuminance_sensor': 'sensor.plant_sensor_7993_illuminance', 'search_for': 'Alocasia ', 'data_source': 'openplantbook', 'entity_picture': 'https://opb-img.plantbook.io/alocasia%20cucullata.jpg', 'display_pid': 'Alocasia cucullata', 'limits': {'max_moisture': 60, 'min_moisture': 15, 'max_illuminance': 22500, 'min_illuminance': 900, 'max_dli': 12, 'min_dli': 5, 'max_temperature': 32, 'min_temperature': 5, 'max_conductivity': 2000, 'min_conductivity': 350, 'max_humidity': 85, 'min_humidity': 30}}}
2023-08-10 20:37:54.250 INFO (MainThread) [custom_components.plant.sensor] Added external sensor for None sensor.plant_sensor_7993_illuminance
2023-08-10 20:37:54.250 DEBUG (MainThread) [custom_components.plant.sensor] Unknown native value for plant.alocasia_illuminance, setting to default: None
2023-08-10 20:37:54.251 DEBUG (MainThread) [custom_components.plant.sensor] Unknown native value for plant.alocasia_conductivity, setting to default: None
2023-08-10 20:37:54.251 DEBUG (MainThread) [custom_components.plant.sensor] Unknown native value for plant.alocasia_soil_moisture, setting to default: None
2023-08-10 20:37:54.251 DEBUG (MainThread) [custom_components.plant.sensor] Unknown native value for plant.alocasia_temperature, setting to default: None
2023-08-10 20:37:54.252 DEBUG (MainThread) [custom_components.plant.sensor] Unknown native value for plant.alocasia_air_humidity, setting to default: None
2023-08-10 20:37:54.252 DEBUG (MainThread) [custom_components.plant.sensor] Unknown native value for plant.alocasia_ppfd_mol, setting to default: None
2023-08-10 20:37:54.296 INFO (MainThread) [custom_components.plant.sensor] Setting sensor.alocasia_illuminance external sensor to sensor.plant_sensor_7993_illuminance
2023-08-10 20:37:54.298 INFO (MainThread) [custom_components.plant.sensor] Setting sensor.alocasia_conductivity external sensor to sensor.plant_sensor_7993_conductivity
2023-08-10 20:37:54.302 INFO (MainThread) [custom_components.plant.sensor] Setting sensor.alocasia_soil_moisture external sensor to sensor.plant_sensor_7993_moisture
2023-08-10 20:37:54.305 INFO (MainThread) [custom_components.plant.sensor] Setting sensor.alocasia_temperature external sensor to sensor.plant_sensor_7993_temperature
2023-08-10 20:37:54.308 INFO (MainThread) [custom_components.plant.sensor] Setting sensor.alocasia_ppfd_mol external sensor to sensor.alocasia_illuminance
2023-08-10 20:37:54.373 ERROR (MainThread) [homeassistant.helpers.entity] Update for plant.alocasia fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 699, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 940, in async_device_update
    await hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/plant/__init__.py", line 682, in update
    humidity = self._hass.states.get(self.sensor_humidity.entity_id).state
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'state'
2023-08-10 20:38:09.367 ERROR (MainThread) [homeassistant.helpers.entity] Update for plant.alocasia fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 699, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 940, in async_device_update
    await hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/plant/__init__.py", line 682, in update
    humidity = self._hass.states.get(self.sensor_humidity.entity_id).state
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'state'
2023-08-10 20:38:24.368 ERROR (MainThread) [homeassistant.helpers.entity] Update for plant.alocasia fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 699, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 940, in async_device_update
    await hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/plant/__init__.py", line 682, in update
    humidity = self._hass.states.get(self.sensor_humidity.entity_id).state
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'state'
2023-08-10 20:38:39.370 ERROR (MainThread) [homeassistant.helpers.entity] Update for plant.alocasia fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 699, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 940, in async_device_update
    await hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/plant/__init__.py", line 682, in update
    humidity = self._hass.states.get(self.sensor_humidity.entity_id).state
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'state'
Olen commented 1 year ago

Looks like a problem with your humidity sensor.

Try to use the "replace sensor" service call to correct it.

morris2009 commented 1 year ago

Ah. I had all the humidity sensors disabled because my xiaomi plant sensor doesn't measure humidity. After enabling the sensor in the entity settings screen the plant monitor gave an OK. Tnx!