Closed celsworth closed 1 year ago
This is a bit unknown because HA doesn't seem to expect status/warning/fault codes like this to be sent to it?
At least, I can't see anything that looks like a matching device_class in https://developers.home-assistant.io/docs/core/entity/sensor/#available-state-classes
So hopefully "None" will work..
This is a bit unknown because HA doesn't seem to expect status/warning/fault codes like this to be sent to it?
At least, I can't see anything that looks like a matching device_class in https://developers.home-assistant.io/docs/core/entity/sensor/#available-state-classes
So hopefully "None" will work..
@celsworth, not sure if you have seen this (see the section about diagnostic categories): https://developers.home-assistant.io/blog/2021/10/26/config-entity/
I believe it would be the most logical place to "categorize" it.
It comes out looking a little something like this in HA:
I will dig around a little to see how to classify those on MQTT.
Thanks @jacovt, this does look promising. The previous solution does indeed fail with this:
2023-08-25 07:26:13.733 ERROR (MainThread) [homeassistant.components.mqtt.mixins] Error 'expected SensorDeviceClass or one of 'date', 'enum', 'timestamp', 'apparent_power', 'aqi', 'atmospheric_pressure', 'battery', 'carbon_monoxide', 'carbon_dioxide', 'current', 'data_rate', 'data_size', 'distance', 'duration', 'energy', 'energy_storage', 'frequency', 'gas', 'humidity', 'illuminance', 'irradiance', 'moisture', 'monetary', 'nitrogen_dioxide', 'nitrogen_monoxide', 'nitrous_oxide', 'ozone', 'ph', 'pm1', 'pm10', 'pm25', 'power_factor', 'power', 'precipitation', 'precipitation_intensity', 'pressure', 'reactive_power', 'signal_strength', 'sound_pressure', 'speed', 'sulphur_dioxide', 'temperature', 'volatile_organic_compounds', 'volatile_organic_compounds_parts', 'voltage', 'volume', 'volume_storage', 'water', 'weight', 'wind_speed' for dictionary value @ data['device_class']'
And none of those are really appropriate. So I think I need to find the magic combination of device_class
/ state_class
/ unit_of_measurement
/ the mqtt topic (which currently is homeassistant/sensor/lxp_BA112121024/status/config
, I think the the sensor
part there is wrong). I'm finding the docs a bit sparse on how to get this right :)
Ok, getting somewhere. Got them to appear in HA and I think simply removing all of device_class / state_class / unit_of_measurement is the way to go.
Having the integers might be a bit useless though, I do wonder if its time to convert them to strings. But I'm not sure I want to change the contents of inputs/all
, so I might have HA watch new messages for these. Yeah time for a new PR to clean all this up :)
Missed in #189