jaroschek / home-assistant-myuplink

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

Negative max on return flow temperature #56

Open siggeb opened 5 months ago

siggeb commented 5 months ago

Just looking at some of my sensors in my newly added integration for this, the "Heating circuit 1 Return flow" seems to give some strange numbers every now and then. Looks like it is being given some sort of negative maximum at -32768 image

siggeb commented 5 months ago

Also found on some more sensors: CTC EcoZenith i360 Hot water Hot water flow temp CTC EcoZenith i360 Hot water Hot water capacity

image image

jaroschek commented 5 months ago

Hello, I understand the Problem. But I have currently no idea, how the integration could cause these wrong values as it passes these values through.

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.

The response of /v2/devices/{deviceId}/points should contain the values you could check.

On the other hand: Do you use any additional frontend extension/Plugin to have these date filters in your quick view of the entity graph? I don't have these filters/selectors in a vanilla Installation of Home Assistant. I'm just thinking, if such an extension/plugin could cause this error during rendering.

siggeb commented 5 months ago

Ok, so I tried the swagger, and I could authorize and get my systems with/v2​/systems​/me. But querying the device endpoint I get an error saying Im not authorized with the right scope as viewer, when I clearly chose it in the auth dialog =(

So I did some digging, and the value reported corresponds to the smallint minimum value -32768. I am thinking that somewhere, either in my device, or in myuplink, this is being set instead of a ral value for some reason. And I have seen that sometimes my device shows "--", indicating that it doesnt know. So this may be the culprit.

I guess it may not be too easy for you to mitigate somehow? Knowing that you may be getting some default values like this, you may want to just ignore them? =)

Or do you know how I could massage this data on my side?

I am really keen to get this working, as I am currently having issues with my heat pump, and this value for the heating circuit return value is actually important for me to track =) So any pointers in how I can rectify bad numbers that I have already gotten would be helpful as well, but most important for future. =)

siggeb commented 5 months ago

I now have observed that there seems to be a correlation with the '--' on the device and the negative smallint, example here the hot water capacity image

siggeb commented 5 months ago

Ok, so I have "solved" or at least found a workaround for the extreme values. Adding it here if anyone needs it.

Using the filter platform sensor type, I created a filtered version of the 3 sensors that give extreme values. Using the range filter I define upper and lower bounds, which basically indicates the issue without ruining the graphs...

sensor:
  - platform: filter
    name: "filtered ctc_ecozenith_i360_hot_water_hot_water_flow_temp"
    entity_id: "sensor.ctc_ecozenith_i360_hot_water_hot_water_flow_temp"
    unique_id: "sensor.ctc_ecozenith_i360_hot_water_hot_water_flow_temp_filtered"
    filters:
      - filter: range
        lower_bound: 0
        upper_bound: 100

image

jaroschek commented 5 months ago

Hello @siggeb, I have now observed that same issue. The API response contains that negative value:

  {
    "category": "NIBE S1255-6 E PC EM 3X400V",
    "parameterId": "54",
    "parameterName": "Average temper­ature (BT1)",
    "parameterUnit": "°C",
    "writable": false,
    "timestamp": "2024-01-17T13:35:02+00:00",
    "value": -32768,
    "strVal": "-32768°C",
    "smartHomeCategories": [
      "sh-outdoorTemp"
    ],
    "minValue": null,
    "maxValue": null,
    "stepValue": 1,
    "enumValues": [],
    "scaleValue": "0.1",
    "zoneId": null
  }

As this can only be a bug inside the API, I would implement what you recommended and just ignore such values.