Leggin / dirigera

This repository provides an unofficial Python client for controlling the IKEA Dirigera Smart Home Hub.
MIT License
110 stars 20 forks source link

Validation errors getting third-party enviroment sensors #82

Closed famichiki closed 1 week ago

famichiki commented 2 weeks ago

In the EnvironmentSensorAttributes class in environment_sensor.py could you please add = None to the optional attributes as below? It's to resolve field required when getting third-party sensors that don't support PM2.5 ov VOC. I get this error with the Sonoff temperature/humidity sensors. Thanks.

class EnvironmentSensorAttributes(Attributes):
    current_temperature: float
    current_r_h: int
    current_p_m25: Optional[int] = None
    max_measured_p_m25: Optional[int] = None
    min_measured_p_m25: Optional[int] = None
    voc_index: Optional[int] = None
LarsJensen69 commented 2 weeks ago

Thanks for adding this issue. I see the same. Unfortunately the sensor added causes the module to crash even sensor is not called. Just added in Dirigera. Did you find a way arround until added here? Added: If I follow your suggestion the Enviroment sensor will not work. The temperature and RH will have same name.

famichiki commented 1 week ago

Which sensor are you using and can you post the message data received here?

LarsJensen69 commented 1 week ago

I am using "Vindstyrka" which works fine as enviromental sensor. When adding the Sonoff SNZB-02P it crashes because it also shows up as enviromental sensor but the variablel names are a bit different for temperature and RH.