Skip to content

Commit

Permalink
(beta): support for HCHO sensor
Browse files Browse the repository at this point in the history
  • Loading branch information
Kakise committed Apr 8, 2022
1 parent 363d16a commit 7f076b6
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions custom_components/dyson_local/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ async def async_setup_entry(
if isinstance(device, DysonPureHumidifyCool) or isinstance(
device, DysonPurifierHumidifyCoolFormaldehyde):
entities.append(DysonNextDeepCleanSensor(device, name))
if isinstance(device, DysonPurifierHumidifyCoolFormaldehyde):
entities.append(DysonHCHOSensor(coordinator, device, name))
async_add_entities(entities)


Expand Down Expand Up @@ -319,3 +321,16 @@ class DysonNO2Sensor(DysonSensorEnvironmental):
def state(self) -> int:
"""Return the state of the sensor."""
return self._device.nitrogen_dioxide

class DysonHCHOSensor(DysonSensorEnvironmental):
"""Dyson sensor for Formaldehyde."""

_SENSOR_TYPE = "hcho"
_SENSOR_NAME = "Formaldehyde"
_attr_device_class = SensorDeviceClass.NONE
_attr_unit_of_measurement = CONCENTRATION_MICROGRAMS_PER_CUBIC_METER

@environmental_property
def state(self) -> int:
"""Return the state of the sensor."""
return self._device.formaldehyde

0 comments on commit 7f076b6

Please sign in to comment.