sanjoyg / dirigera_platform

HomeAssistant Integration for Dirigera Platform
MIT License
71 stars 8 forks source link

Vindstyrka Enviroment Sensor broken #31

Closed acces90 closed 2 months ago

acces90 commented 2 months ago

with the newest version of this addon my enviroment sensor is broken

here the logs:

2024-04-11 21:05:34.571 ERROR (MainThread) [custom_components.dirigera_platform] error encountered running update on : Luftsensor
2024-04-11 21:05:34.571 ERROR (MainThread) [custom_components.dirigera_platform] 'ikea_vindstyrka_device' object has no attribute 'hass'
2024-04-11 21:05:34.571 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.luftsensor_temperature fails
Traceback (most recent call last):
  File "/config/custom_components/dirigera_platform/sensor.py", line 93, in async_update
    self._json_data = await self.hass.async_add_executor_job(self._hub.get_environment_sensor_by_id, self._json_data.id)
                            ^^^^^^^^^
AttributeError: 'ikea_vindstyrka_device' object has no attribute 'hass'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 951, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1268, in async_device_update
    await self.async_update()
  File "/config/custom_components/dirigera_platform/sensor.py", line 175, in async_update
    await self._ikea_env_device.async_update()
  File "/config/custom_components/dirigera_platform/sensor.py", line 100, in async_update
    raise HomeAssistantError(ex, DOMAIN, "hub_exception")
homeassistant.exceptions.HomeAssistantError: (AttributeError("'ikea_vindstyrka_device' object has no attribute 'hass'"), 'dirigera_platform', 'hub_exception')
2024-04-11 21:05:34.574 ERROR (MainThread) [custom_components.dirigera_platform] error encountered running update on : Luftsensor
2024-04-11 21:05:34.574 ERROR (MainThread) [custom_components.dirigera_platform] 'ikea_vindstyrka_device' object has no attribute 'hass'
2024-04-11 21:05:34.575 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.luftsensor_humidity fails
Traceback (most recent call last):
  File "/config/custom_components/dirigera_platform/sensor.py", line 93, in async_update
    self._json_data = await self.hass.async_add_executor_job(self._hub.get_environment_sensor_by_id, self._json_data.id)
                            ^^^^^^^^^
AttributeError: 'ikea_vindstyrka_device' object has no attribute 'hass'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 951, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1268, in async_device_update
    await self.async_update()
  File "/config/custom_components/dirigera_platform/sensor.py", line 175, in async_update
    await self._ikea_env_device.async_update()
  File "/config/custom_components/dirigera_platform/sensor.py", line 100, in async_update
    raise HomeAssistantError(ex, DOMAIN, "hub_exception")
homeassistant.exceptions.HomeAssistantError: (AttributeError("'ikea_vindstyrka_device' object has no attribute 'hass'"), 'dirigera_platform', 'hub_exception')
2024-04-11 21:05:34.576 ERROR (MainThread) [custom_components.dirigera_platform] error encountered running update on : Luftsensor
2024-04-11 21:05:34.576 ERROR (MainThread) [custom_components.dirigera_platform] 'ikea_vindstyrka_device' object has no attribute 'hass'
2024-04-11 21:05:34.576 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.luftsensor_current_pm2_5 fails
Traceback (most recent call last):
  File "/config/custom_components/dirigera_platform/sensor.py", line 93, in async_update
    self._json_data = await self.hass.async_add_executor_job(self._hub.get_environment_sensor_by_id, self._json_data.id)
                            ^^^^^^^^^
AttributeError: 'ikea_vindstyrka_device' object has no attribute 'hass'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 951, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1268, in async_device_update
    await self.async_update()
  File "/config/custom_components/dirigera_platform/sensor.py", line 175, in async_update
    await self._ikea_env_device.async_update()
  File "/config/custom_components/dirigera_platform/sensor.py", line 100, in async_update
    raise HomeAssistantError(ex, DOMAIN, "hub_exception")
homeassistant.exceptions.HomeAssistantError: (AttributeError("'ikea_vindstyrka_device' object has no attribute 'hass'"), 'dirigera_platform', 'hub_exception')
2024-04-11 21:05:34.578 ERROR (MainThread) [custom_components.dirigera_platform] error encountered running update on : Luftsensor
2024-04-11 21:05:34.578 ERROR (MainThread) [custom_components.dirigera_platform] 'ikea_vindstyrka_device' object has no attribute 'hass'
2024-04-11 21:05:34.578 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.luftsensor_max_measured_pm2_5 fails
Traceback (most recent call last):
  File "/config/custom_components/dirigera_platform/sensor.py", line 93, in async_update
    self._json_data = await self.hass.async_add_executor_job(self._hub.get_environment_sensor_by_id, self._json_data.id)
                            ^^^^^^^^^
AttributeError: 'ikea_vindstyrka_device' object has no attribute 'hass'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 951, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1268, in async_device_update
    await self.async_update()
  File "/config/custom_components/dirigera_platform/sensor.py", line 175, in async_update
    await self._ikea_env_device.async_update()
  File "/config/custom_components/dirigera_platform/sensor.py", line 100, in async_update
    raise HomeAssistantError(ex, DOMAIN, "hub_exception")
homeassistant.exceptions.HomeAssistantError: (AttributeError("'ikea_vindstyrka_device' object has no attribute 'hass'"), 'dirigera_platform', 'hub_exception')
2024-04-11 21:05:34.579 ERROR (MainThread) [custom_components.dirigera_platform] error encountered running update on : Luftsensor
2024-04-11 21:05:34.580 ERROR (MainThread) [custom_components.dirigera_platform] 'ikea_vindstyrka_device' object has no attribute 'hass'
2024-04-11 21:05:34.580 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.luftsensor_min_measured_pm2_5 fails
Traceback (most recent call last):
  File "/config/custom_components/dirigera_platform/sensor.py", line 93, in async_update
    self._json_data = await self.hass.async_add_executor_job(self._hub.get_environment_sensor_by_id, self._json_data.id)
                            ^^^^^^^^^
AttributeError: 'ikea_vindstyrka_device' object has no attribute 'hass'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 951, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1268, in async_device_update
    await self.async_update()
  File "/config/custom_components/dirigera_platform/sensor.py", line 175, in async_update
    await self._ikea_env_device.async_update()
  File "/config/custom_components/dirigera_platform/sensor.py", line 100, in async_update
    raise HomeAssistantError(ex, DOMAIN, "hub_exception")
homeassistant.exceptions.HomeAssistantError: (AttributeError("'ikea_vindstyrka_device' object has no attribute 'hass'"), 'dirigera_platform', 'hub_exception')
2024-04-11 21:05:34.581 ERROR (MainThread) [custom_components.dirigera_platform] error encountered running update on : Luftsensor
2024-04-11 21:05:34.581 ERROR (MainThread) [custom_components.dirigera_platform] 'ikea_vindstyrka_device' object has no attribute 'hass'
2024-04-11 21:05:34.581 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.luftsensor_voc_index fails
Traceback (most recent call last):
  File "/config/custom_components/dirigera_platform/sensor.py", line 93, in async_update
    self._json_data = await self.hass.async_add_executor_job(self._hub.get_environment_sensor_by_id, self._json_data.id)
                            ^^^^^^^^^
AttributeError: 'ikea_vindstyrka_device' object has no attribute 'hass'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 951, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1268, in async_device_update
    await self.async_update()
  File "/config/custom_components/dirigera_platform/sensor.py", line 175, in async_update
    await self._ikea_env_device.async_update()
  File "/config/custom_components/dirigera_platform/sensor.py", line 100, in async_update
    raise HomeAssistantError(ex, DOMAIN, "hub_exception")
homeassistant.exceptions.HomeAssistantError: (AttributeError("'ikea_vindstyrka_device' object has no attribute 'hass'"), 'dirigera_platform', 'hub_exception')
vulcanoid1975 commented 2 months ago

Hi,

I have 5 of those, and have no similar issue: image

image

Just did an update on the integration as per @sanjoyg 's launch ... (Many Many Thanks BTW!)

acces90 commented 2 months ago

mhhh weird. I just reinstalled the addon and suddenly it works.

Before that I tried restarting HA several times without success...

acces90 commented 2 months ago

Nah, same thing, worked for like 1 minute and then same logs as above

vulcanoid1975 commented 2 months ago

I reloaded the integration after update (which need the restart anyway) ... that's it ... All devices work as they were ...

sanjoyg commented 2 months ago

Still getting the issue?

acces90 commented 2 months ago

yep, it gets the first values when initializing i guess and then the errors in logs occure. I have the same firmware as @vulcanoid1975. The device itself is okay, it works in Ikea Home Smart app

vulcanoid1975 commented 2 months ago

The logs show these errors:

This error originated from a custom integration.

Logger: custom_components.dirigera_platform Source: custom_components/dirigera_platform/sensor.py:99 integration: IKEA Dirigera Hub Integration (documentation, issues) First occurred: 7:13:01 PM (150 occurrences) Last logged: 7:15:01 PM

and:

'ikea_vindstyrka_device' object has no attribute 'hass'

Logger: homeassistant.helpers.entity Source: helpers/entity.py:951 First occurred: 7:13:01 PM (150 occurrences) Last logged: 7:15:01 PM

Update for sensor.sensor_office_humidity fails Update for sensor.sensor_office_current_pm2_5 fails Update for sensor.sensor_office_max_measured_pm2_5 fails Update for sensor.sensor_office_min_measured_pm2_5 fails Update for sensor.sensor_office_voc_index fails Traceback (most recent call last): File "/config/custom_components/dirigera_platform/sensor.py", line 93, in async_update self._json_data = await self.hass.async_add_executor_job(self._hub.get_environment_sensor_by_id, self._json_data.id) ^^^^^^^^^ AttributeError: 'ikea_vindstyrka_device' object has no attribute 'hass'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 951, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1268, in async_device_update await self.async_update() File "/config/custom_components/dirigera_platform/sensor.py", line 175, in async_update await self._ikea_env_device.async_update() File "/config/custom_components/dirigera_platform/sensor.py", line 100, in async_update raise HomeAssistantError(ex, DOMAIN, "hub_exception") homeassistant.exceptions.HomeAssistantError: (AttributeError("'ikea_vindstyrka_device' object has no attribute 'hass'"), 'dirigera_platform', 'hub_exception')

But everything is working ... specifically with the devices reporting the error (Office):

image

image

sanjoyg commented 2 months ago

Let me check this

vulcanoid1975 commented 2 months ago

Just to confirm @acces90 report:

image

The sensors are not updating ...

@acces90 sorry my post was misleading, it seems the sensors only update after a reboot or reload of the integration.

Just reloaded the integration and:

image

sanjoyg commented 2 months ago

This is fixed, there was a code bug. Was introduced during the async implementation. @acces90 do check and let know please

acces90 commented 2 months ago

there are no errors in logs appearing and in the logs I see that it pulls the actual values of my sensors (both environment sensor and the pm25 from air purifier) but those values are not updated for the entities. I'm positive it's not my HA because my other non-IKEA sensors update their values.

vulcanoid1975 commented 2 months ago

I'll second that ... image image

sanjoyg commented 2 months ago

It seems the changes in the sensor is not pushed to hub thus to the component. Reverted to local polling, should work now please let know

sanjoyg commented 2 months ago

While you check this, could you also test the motion sensor if that works

vulcanoid1975 commented 2 months ago

Good Morning,

It seems to be working now: image image image

Installed the update 10 mins ago, and sensors have updated with changes to environment conditions accordingly. Logs are clean, no errors.

I don't have motion sensors from Ikea, but I was going to buy one, I'll report back probably today.

Thank You @sanjoyg!

sanjoyg commented 2 months ago

Perfect, please do let me know once you can check with motion sensor. Closing this for now.

vulcanoid1975 commented 2 months ago

Just for confirmation: image

I had moved the Sensor in the Bathroom and Kitchen to ZigbeetoMQTT and maintained the Sensors in the Office and Bedroom on Dirigera ... updates are further in between but that's already what happened before ...

Again, Thank you!