jaroschek / home-assistant-myuplink

Custom Home Assistant integration for devices and sensors in myUplink account.
39 stars 8 forks source link

Connection partly fails with Home Assistant 2024.1.2 #55

Closed karimononen closed 5 months ago

karimononen commented 5 months ago

Anyone else having problems with the Core v. 2024.1.2, Operating system v. 11.4?

Everything worked like charm before the update.

Now the connection with the myuplink API works only partly. It can get the initial values but then the value updates fail.

The logbook says "xxx became unavailable" for all sensors after setting up the integration.

I have removed and recreated new application several times in dev.myuplink.com/apps service and re-installed the home assistant integration to get a fresh restart.

myuplink

7RST1 commented 5 months ago

I just updated mine to 2024.1.2 as well, but I haven't had any issues so far.

Does the debug-log say anything?

karimononen commented 5 months ago

Hello 7RST1, I get two errormessages while setting up the integration. They don't look fatal to me but I'm not familiar with the mechanics of this integration.

Logger: homeassistant.components.sensor Source: helpers/entity_platform.py:368 Integration: Sensor (documentation, issues) First occurred: 05:22:54 (1 occurrences) Last logged: 05:22:54

Error while setting up myuplink platform for sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 368, in _async_setup_platform await asyncio.gather(pending) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities await asyncio.gather(tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 752, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1278, in add_to_platform_finish self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 941, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1062, in _async_write_ha_state state, attr, capabilities, shadowed_attr = self.async_calculate_state() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 999, in async_calculate_state state = self._stringify_state(available) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 947, in _stringify_state if (state := self.state) is None: ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 618, in state raise ValueError( ValueError: Sensor sensor.ctc_ecozenith_i255_general_mixing_valve_delay provides state value '0', which is not in the list of options provided

and

Logger: homeassistant.components.sensor Source: helpers/entity_platform.py:507 Integration: Sensor (documentation, issues) First occurred: 05:22:54 (1 occurrences) Last logged: 05:22:54

Error adding entities for domain sensor with platform myuplink Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities await asyncio.gather(*tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 752, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1278, in add_to_platform_finish self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 941, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1062, in _async_write_ha_state state, attr, capabilities, shadowed_attr = self.async_calculate_state() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 999, in async_calculate_state state = self._stringify_state(available) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 947, in _stringify_state if (state := self.state) is None: ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 618, in state raise ValueError( ValueError: Sensor sensor.ctc_ecozenith_i255_general_mixing_valve_delay provides state value '0', which is not in the list of options provided

karimononen commented 5 months ago

Another funny thing is that the trends seem to stay stored somewhere even if I delete the device.

I can see the history of the entity values time before I installed the integration. The data must be from earlier installation.

I deleted the device and restarted HA in between.

karimononen commented 5 months ago

Third error message

Logger: homeassistant.components.sensor Source: helpers/entity_platform.py:507 Integration: Sensor (documentation, issues) First occurred: 05:22:54 (1 occurrences) Last logged: 05:22:54

Error adding entities for domain sensor with platform myuplink Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities await asyncio.gather(*tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 752, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1278, in add_to_platform_finish self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 941, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1062, in _async_write_ha_state state, attr, capabilities, shadowed_attr = self.async_calculate_state() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 999, in async_calculate_state state = self._stringify_state(available) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 947, in _stringify_state if (state := self.state) is None: ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 618, in state raise ValueError( ValueError: Sensor sensor.ctc_ecozenith_i255_general_mixing_valve_delay provides state value '0', which is not in the list of options provided

jaroschek commented 5 months ago

Hello @karimononen,

the errors seem to point to a parameter/entity that may be defined as enum using predefined values from api as options. But somehow a value is provided that is not available in the given list of options.

The enum options are provided as part of the response of /v2/devices/{deviceId}/points like in the following example:

  {
    "category": "NIBE S1255-6 E PC EM 3X400V",
    "parameterId": "55000",
    "parameterName": "Priority",
    "parameterUnit": "",
    "writable": false,
    "timestamp": "2024-01-12T04:12:08+00:00",
    "value": 20,
    "strVal": "Hot water",
    "smartHomeCategories": [],
    "minValue": null,
    "maxValue": null,
    "stepValue": 1,
    "enumValues": [
      {
        "value": "10",
        "text": "Off",
        "icon": ""
      },
      {
        "value": "20",
        "text": "Hot water",
        "icon": ""
      },
      {
        "value": "25",
        "text": "Ext. hot water",
        "icon": ""
      },
      {
        "value": "30",
        "text": "Heating",
        "icon": ""
      },
      {
        "value": "40",
        "text": "Pool",
        "icon": ""
      },
      {
        "value": "41",
        "text": "Pool 2",
        "icon": ""
      },
      {
        "value": "50",
        "text": "Transfer",
        "icon": ""
      },
      {
        "value": "60",
        "text": "Cooling",
        "icon": ""
      }
    ],
    "scaleValue": "1",
    "zoneId": null
  },

Here also is no option with value 0 and the property value should also never contain a value 0.

Can you try and check the direct API response of the parameter points?

Go to the MyUplink Swagger site, and authorize (top right). Find your device ID by querying ​/v2​/systems​/me, enter it when querying /v2/devices/{deviceId}/points.

Can you please paste the parameter points response here, so we can take a look?

karimononen commented 5 months ago

Hello jaroschek, Very kind of you to help me! Appreciated!

Here is a link to the response from swagger that you asked.

response.json

karimononen commented 5 months ago

Hello @jaroschek ,

Thanks, the integration works again! Very happy that you fixed it so soon!

Cheers!