ha-dyson icon indicating copy to clipboard operation
ha-dyson copied to clipboard

HP09 Can't see HCHO value

Open evan85 opened this issue 2 years ago • 10 comments

I integrated HP09 as 527E into my HA, but I cannot see hcho(Formaldehyde). Would you please help to resolve this problem. 3FB3BE22-65A3-4AEA-A5FF-E02D4B12BB6E

evan85 avatar Nov 04 '21 03:11 evan85

I also have the HP09 and I am using Dyson Local with great success - thank you.

FYI: regarding HCHO and HCHR the following lines are written to the home-assistant.log every 30 seconds, including the hcho and hchr values:

2021-11-24 16:59:02 DEBUG (Thread-7) [libdyson.dyson_device] New environmental state: {'msg': 'ENVIRONMENTAL-CURRENT-SENSOR-DATA', 'time': '2021-11-24T15:59:02.000Z', 'data': {'tact': '2927', 'hact': '0049', 'pm25': '0000', 'pm10': '0000', 'va10': '0019', 'noxl': '0002', 'p25r': '0001', 'p10r': '0001', 'hcho': '0003', 'hchr': '0009', 'sltm': 'OFF'}}

alex-zilmer avatar Nov 24 '21 16:11 alex-zilmer

hcho not shown on my TP09. I selected device type Pure Cool Formaldehyde

{'tact': '2967', 'hact': '0039', 'pm25': '0004', 'pm10': '0002', 'va10': '0027', 'noxl': '0002', 'p25r': '0005', 'p10r': '0005', 'hcho': '0004', 'hchr': '0012', 'sltm': 'OFF'}}

CaiNiaoLucifer avatar Nov 25 '21 17:11 CaiNiaoLucifer

FWIW the air quality integration is no longer present in the integration — and there's no official sensor device class for HCHO, yet.

Adding HCHO without the device class should still be possible, though.

Flameeyes avatar Dec 12 '21 15:12 Flameeyes

Sorry for not replying earlier. I tried a few things at home to check if it'd work but unfortunately I don't own an HP09 so I can't make any commits because I can't test with the proper hardware.

Kakise avatar Dec 15 '21 09:12 Kakise

In home assistant, there are no SensorDeviceClass.Formaldehyde class, so you can only use such as SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS class. And you can modify "sensor.py" like this to display Formaldehyde in home assistant with VOLATILE_ORGANIC_COMPOUNDS class. I have try it and it works fine.

Add to the end of "sensor.py"

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

    _SENSOR_TYPE = "hcho"
    _SENSOR_NAME = "Formaldehyde"
    _attr_device_class = SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS
    _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

Replace line 59-65 in "sensor.py"

if isinstance(device, DysonPurifierHumidifyCoolFormaldehyde):
    entities.extend(
        [
            DysonPM25Sensor(coordinator, device, name),
            DysonPM10Sensor(coordinator, device, name),
            DysonNO2Sensor(coordinator, device, name),
            DysonHCHOSensor(coordinator, device, name),
        ]
    )
else:
    entities.extend(
        [
            DysonPM25Sensor(coordinator, device, name),
            DysonPM10Sensor(coordinator, device, name),
            DysonNO2Sensor(coordinator, device, name),
        ]
    )

zhengran14 avatar Mar 15 '22 03:03 zhengran14

I adapted your code a bit @zhengran14 and pushed them into main, could you install the pre-release v0.16.4-2 and test it with your device ?

Kakise avatar Apr 08 '22 17:04 Kakise

I adapted your code a bit @zhengran14 and pushed them into main, could you install the pre-release v0.16.4-2 and test it with your device ?

I will try it and if I have any result, I will tell you. But recently I have no time, so I need some time.

zhengran14 avatar Apr 10 '22 16:04 zhengran14

I adapted your code a bit @zhengran14 and pushed them into main, could you install the pre-release v0.16.4-2 and test it with your device ?

When I use 'v0.16.4-4', ha crash. @Kakise

zhengran14 avatar Apr 21 '22 06:04 zhengran14

I adapted your code a bit @zhengran14 and pushed them into main, could you install the pre-release v0.16.4-2 and test it with your device ?

When I use 'v0.16.4-4', ha crash. @Kakise

Can you post the crash logs ?

Kakise avatar Apr 22 '22 12:04 Kakise

I adapted your code a bit @zhengran14 and pushed them into main, could you install the pre-release v0.16.4-2 and test it with your device ?

When I use 'v0.16.4-4', ha crash. @Kakise

Can you post the crash logs ?

@Kakise I update HA and test, HCHO is working, no crash, no bug, it's nice, thank you very much!

zhengran14 avatar Aug 03 '22 04:08 zhengran14