JoDehli / PyLoxone

Python Loxone binding
Apache License 2.0
162 stars 40 forks source link

[Request]: Add a new sensor type for device_class water #264

Closed s1rlon closed 5 days ago

s1rlon commented 1 month ago

Describe the bug

https://github.com/JoDehli/PyLoxone/blob/master/custom_components/loxone/sensor.py#L67

The SENSOR_TYPES tuple currently does not have a device_class water represented.

Here is an example of a water sensor in loxone:

{
  "13a78abe-01c0-1d71-ffffeab7a19e67ff":
    {
      "name": "Cold Water",
      "type": "InfoOnlyAnalog",
      "uuidAction": "13a78abe-01c0-1d71-ffffeab7a19e67ff",
      "room": "13a6623e-0195-2031-ffffc1fe7adce52a",
      "cat": "13a78b03-0007-4f8b-ffffc1fe7adce52a",
      "defaultRating": 0,
      "isFavorite": false,
      "isSecured": false,
      "defaultIcon": "IconsFilled/drop.svg",
      "restrictions": 0,
      "details": { "jLockable": false, "format": "%.3f m³" },
      "states":
        {
          "value": "13a78abe-01c0-1d71-ffffeab7a19e67ff",
          "error": "13a78abe-01c0-1d70-ffff1a2c2b7bd075",
        },
      "statistic":
        {
          "frequency": 6,
          "outputs":
            [
              {
                "id": 0,
                "name": "Cold Water",
                "format": "%.3f m³",
                "uuid": "13a78abe-01c0-1d6f-ffff1a2c2b7bd075",
                "visuType": 2
              }
            ]
        }
    }
}

Firmware of your Miniserver

14.5.12.7

HomeAssistant install method

docker

Version of HomeAssistant

2024.4.3

Version of Pyloxone

0.6.4

Update pyloxone

yes

Log

No response

JoDehli commented 2 weeks ago

@s1rlon It is not missing it is not there because it can not be parsed according to the format. You define a sensor in loxone and give a unit of measurement by defining the format string. On the homeassistant I try to parse the format string and give the right device class. But what should I do with m³. It can be gas or water. So I decided do do nothing and you must define it separately in the customize section. There you can override the the device class to water.