jason0x43 / hacs-hubitat

A Hubitat integration for Home Assistant
MIT License
191 stars 46 forks source link

Numerical states recognized as categorical values #188

Open matfax opened 1 year ago

matfax commented 1 year ago

Some of my integrated sensor states are shown as categorical values, not as numerical values. I presume that they aren't internally recognized as integers but as strings instead. This means that units can't be adjusted or added to these numerics and statistical graphs can't properly process the data.

jason0x43 commented 1 year ago

What kinds of sensors are they, and what are the state values you're getting?

matfax commented 1 year ago

Instances include air quality sensors, power meters. The uncommon fields receive numerical values which are presented as states instead of numbers.

energy_cost

Karunamon commented 1 year ago

Can confirm I see this on certain sensor readings from an air quality device. It's not every numeric, for instance CO2 is reported properly but PM 2.5 shows up as a state.

Some debug logging shows that the problematic values are being set to a "unit" of None:


2023-07-16 08:51:38.175 DEBUG (MainThread) [custom_components.hubitat.hubitatmaker.hub] Received event: {'name': 'temperature', 'value': '67.8', 'displayName': 'AQI Sensor', 'deviceId': '243', 'descriptionText': None, 'unit': '°F', 'type': None, 'data': None}
2023-07-16 08:51:38.175 DEBUG (MainThread) [custom_components.hubitat.hubitatmaker.hub] Updating temperature of 243 to 67.8 (°F)
2023-07-16 08:51:40.142 DEBUG (MainThread) [custom_components.hubitat.hubitatmaker.hub] Received event: {'name': 'VOC', 'value': '1.7', 'displayName': 'AQI Sensor', 'deviceId': '243', 'descriptionText': None, 'unit': 'mg/m3', 'type': None, 'data': None}
2023-07-16 08:51:40.142 DEBUG (MainThread) [custom_components.hubitat.hubitatmaker.hub] Updating VOC of 243 to 1.7 (mg/m3)
2023-07-16 08:51:40.214 DEBUG (MainThread) [custom_components.hubitat.hubitatmaker.hub] Received event: {'name': 'humidity', 'value': '36.4', 'displayName': 'AQI Sensor', 'deviceId': '243', 'descriptionText': None, 'unit': '%', 'type': None, 'data': None}
2023-07-16 08:51:40.214 DEBUG (MainThread) [custom_components.hubitat.hubitatmaker.hub] Updating humidity of 243 to 36.4 (%)
2023-07-16 08:51:40.255 DEBUG (MainThread) [custom_components.hubitat.hubitatmaker.hub] Received event: {'name': 'PM2.5', 'value': '8', 'displayName': 'AQI Sensor', 'deviceId': '243', 'descriptionText': None, 'unit': None, 'type': None, 'data': None}
2023-07-16 08:51:40.255 DEBUG (MainThread) [custom_components.hubitat.hubitatmaker.hub] Updating PM2.5 of 243 to 8 (None)

… Which appears to be reported directly from the device:

image

Partially disregard that.

Formaldehyde reports with a unit of "PPM" but shows up in HA as a categorical value. I've got nothing.

Is there a way to override this?