From 74940c01666c4fe3217e239178dcfa65dee25509 Mon Sep 17 00:00:00 2001 From: Kev Date: Sun, 28 Apr 2024 19:46:38 -0400 Subject: [PATCH] Add units to smoke sensor --- custom_components/pirateweather/sensor.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/custom_components/pirateweather/sensor.py b/custom_components/pirateweather/sensor.py index 49a47b2..a474ce6 100644 --- a/custom_components/pirateweather/sensor.py +++ b/custom_components/pirateweather/sensor.py @@ -26,6 +26,7 @@ from homeassistant.const import ( ATTR_ATTRIBUTION, + CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, CONF_API_KEY, CONF_LATITUDE, CONF_LONGITUDE, @@ -392,6 +393,11 @@ class PirateWeatherSensorEntityDescription(SensorEntityDescription): key="smoke", name="Smoke", state_class=SensorDeviceClass.PM25, + si_unit=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, + us_unit=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, + ca_unit=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, + uk_unit=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, + uk2_unit=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, suggested_display_precision=2, icon="mdi:smoke", forecast_mode=["currently", "hourly"], @@ -400,6 +406,11 @@ class PirateWeatherSensorEntityDescription(SensorEntityDescription): key="smoke_max", name="Smoke Max", state_class=SensorDeviceClass.PM25, + si_unit=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, + us_unit=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, + ca_unit=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, + uk_unit=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, + uk2_unit=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, suggested_display_precision=2, icon="mdi:smoke", forecast_mode=["daily"],