tuya / tuya-home-assistant

Home Assistant integration for controlling Powered by Tuya (PBT) devices using Tuya Open API, maintained by the Home Assistant Community and Tuya Developer Team.
MIT License
882 stars 207 forks source link

Tuya Multi Channel Weather Station - no entities for extra channels #902

Open fjepsen opened 1 year ago

fjepsen commented 1 year ago

Describe the bug

I have a weather station which HA reports as: "model": "C6082A", "category": "wsdcg", "product_id": "xpxdr5q6vc8aztq0", "product_name": "Smart multi-channel weather station", It has an indoor panel with temp and humidity sensors, plus 7 wireless additional sensor modules each with temp and humidity also. I am running with the inbuilt Tuya integration which picks up the unit from the Smart Life app successfully. HA gets the indoor temp and humidity correctly, However none of the additional sensors are reported into HA.

It was reported here: https://github.com/home-assistant/core/issues/85207 but I thought here would be a better place.

Expected behavior

All 7 extra channels should also get entities.

Diagnostics for integrations and devices config_entry-tuya-8a96b3520ce93f69119a4d5af86405f2.json.txt

Home Assistant Version

fjepsen commented 1 year ago

If I am correct to solve it the following shoud be added to /homeassistant/components/tuya/sensor.py at line 623:

        TuyaSensorEntityDescription(
            key=DPCode.CH1_TEMP,
            name="Temperature CH1",
            device_class=SensorDeviceClass.TEMPERATURE,
            state_class=SensorStateClass.MEASUREMENT,
        ),
        TuyaSensorEntityDescription(
            key=DPCode.CH1_HUMI,
            name="Humidity CH1",
            device_class=SensorDeviceClass.HUMIDITY,
            state_class=SensorStateClass.MEASUREMENT,
        ),
        TuyaSensorEntityDescription(
            key=DPCode.CH2_TEMP,
            name="Temperature CH2",
            device_class=SensorDeviceClass.TEMPERATURE,
            state_class=SensorStateClass.MEASUREMENT,
        ),
        TuyaSensorEntityDescription(
            key=DPCode.CH2_HUMI,
            name="Humidity CH2",
            device_class=SensorDeviceClass.HUMIDITY,
            state_class=SensorStateClass.MEASUREMENT,
        ),
        TuyaSensorEntityDescription(
            key=DPCode.CH3_TEMP,
            name="Temperature CH3",
            device_class=SensorDeviceClass.TEMPERATURE,
            state_class=SensorStateClass.MEASUREMENT,
        ),
        TuyaSensorEntityDescription(
            key=DPCode.CH3_HUMI,
            name="Humidity CH3",
            device_class=SensorDeviceClass.HUMIDITY,
            state_class=SensorStateClass.MEASUREMENT,
        ),
        TuyaSensorEntityDescription(
            key=DPCode.CH4_TEMP,
            name="Temperature CH4",
            device_class=SensorDeviceClass.TEMPERATURE,
            state_class=SensorStateClass.MEASUREMENT,
        ),
        TuyaSensorEntityDescription(
            key=DPCode.CH4_HUMI,
            name="Humidity CH4",
            device_class=SensorDeviceClass.HUMIDITY,
            state_class=SensorStateClass.MEASUREMENT,
        ),
        TuyaSensorEntityDescription(
            key=DPCode.CH5_TEMP,
            name="Temperature CH5",
            device_class=SensorDeviceClass.TEMPERATURE,
            state_class=SensorStateClass.MEASUREMENT,
        ),
        TuyaSensorEntityDescription(
            key=DPCode.CH5_HUMI,
            name="Humidity CH5",
            device_class=SensorDeviceClass.HUMIDITY,
            state_class=SensorStateClass.MEASUREMENT,
        ),
        TuyaSensorEntityDescription(
            key=DPCode.CH6_TEMP,
            name="Temperature CH6",
            device_class=SensorDeviceClass.TEMPERATURE,
            state_class=SensorStateClass.MEASUREMENT,
        ),
        TuyaSensorEntityDescription(
            key=DPCode.CH6_HUMI,
            name="Humidity CH6",
            device_class=SensorDeviceClass.HUMIDITY,
            state_class=SensorStateClass.MEASUREMENT,
        ),
        TuyaSensorEntityDescription(
            key=DPCode.CH7_TEMP,
            name="Temperature CH7",
            device_class=SensorDeviceClass.TEMPERATURE,
            state_class=SensorStateClass.MEASUREMENT,
        ),
        TuyaSensorEntityDescription(
            key=DPCode.CH7_HUMI,
            name="Humidity CH7",
            device_class=SensorDeviceClass.HUMIDITY,
            state_class=SensorStateClass.MEASUREMENT,
        ),
fjepsen commented 1 year ago

I also had to add in const.py at line 137:

    CH1_TEMP = "ch1_temp" 
    CH1_HUMI = "ch1_humi"
    CH2_TEMP = "ch2_temp" 
    CH2_HUMI = "ch2_humi"
    CH3_TEMP = "ch3_temp" 
    CH3_HUMI = "ch3_humi"
    CH4_TEMP = "ch4_temp" 
    CH4_HUMI = "ch4_humi"
    CH5_TEMP = "ch5_temp" 
    CH5_HUMI = "ch5_humi"
    CH6_TEMP = "ch6_temp" 
    CH6_HUMI = "ch6_humi"
    CH7_TEMP = "ch7_temp" 
    CH7_HUMI = "ch7_humi"

Tested it as custom integration by copying the tuya folder to config/custom_components/tuya and inserting "version": "1.0.0", to manifest.json. Now I have 16 entities instead of only 2. 😀

verticalperformance commented 1 year ago

I also would like this support added. Suspect I have the same weather station and get the same behaviour (CH1 thu 7 not reported) "model": "C6082A", "category": "wsdcg", "product_id": "xpxdr5q6vc8aztq0", "product_name": "Smart multi-channel weather station",

derdanman commented 3 months ago

Hey @fjepsen , is this still working for you?

I got the same device, did both changes as you did (except to line numbers, but it´s under the wsdcg section) but my second channel is not showing up. Though the custom integration works as the original does.

Also in the Tuya developer account I can see that those attibutes are there and named as you named them.

Any ideas what´s going wrong with my setup?