home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.24k stars 30.59k forks source link

Soil sensor unsuported tuya integration #93536

Closed infoscoot closed 1 year ago

infoscoot commented 1 year ago

The problem

Soil sensor appears as unsupported, but inside diagnostic data I see real values : "status": { "humidity": 39, "temp_current": 17, "temp_unit_convert": "c", "battery_state": "middle", "battery_percentage": 30

What version of Home Assistant Core has the issue?

core-2023.5.3

What was the last working version of Home Assistant Core?

core-2023.5.3

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Tuya integration

Link to integration documentation on our website

https://www.home-assistant.io/integrations/tuya/

Diagnostics information

tuya-63a44346a6d1e30a76508fc4804943ea-Soil sensor-c4d0be11cd1334618e491a9e65b35920.json.txt

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 1 year ago

Hey there @tuya, @zlinoliver, @frenck, mind taking a look at this issue as it has been labeled with an integration (tuya) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `tuya` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign tuya` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


tuya documentation tuya source (message by IssueLinks)

badmadscientist commented 1 year ago

I'm having the exact same issue here, using a "Moes Tuya-Zigbee gateway" and "FRANKEVER" soil meter. As OP stated, the data is inside the diagnostic data.

andymarden commented 1 year ago

same issue here - hope we get a fix soon

andymarden commented 1 year ago

It just needs another dictionary in here right? https://github.com/home-assistant/core/blob/dev/homeassistant/components/tuya/sensor.py

If had a dev setup, I would do a PR request myself.

Product code is: zwjcy. Probably much the same as that for wkcz.

lukelalo commented 1 year ago

Based on Tuya IOT platform, I think the soil sensor should be something like

    # Soil sensor
    # "Bluetooth Soil Moisture tester SGS01"
    # Documentation not found
    "zwjcy": (
        TuyaSensorEntityDescription(
            key=DPCode.HUMIDITY,
            name="Humidity",
            device_class=SensorDeviceClass.HUMIDITY,
            state_class=SensorStateClass.MEASUREMENT,
        ),
        TuyaSensorEntityDescription(
            key=DPCode.TEMP_CURRENT,
            name="Temperature",
            device_class=SensorDeviceClass.TEMPERATURE,
            state_class=SensorStateClass.MEASUREMENT,
        ),
        TuyaSensorEntityDescription(
             key=DPCode.BATTERY_PERCENTAGE,
             name="Battery",
             native_unit_of_measurement=PERCENTAGE,
             device_class=SensorDeviceClass.BATTERY,
             state_class=SensorStateClass.MEASUREMENT,
             entity_category=EntityCategory.DIAGNOSTIC,
         ),
         TuyaSensorEntityDescription(
             key=DPCode.BATTERY_STATE,
             name="Battery state",
             icon="mdi:battery",
             entity_category=EntityCategory.DIAGNOSTIC,
         ),
    ),

This sensor is exposing battery_state and battery_percentage. I'm not sure if you include the four *BATTERY_SENSORS it would crash or just simply ignore the two missing DPCodes, so I've included only the two exposed values.

This is the debug information from Tuya IOT:

Code Type Values
temp_unit_convert Enum { "range": [ "c", "f" ] }
Code Type Values
humidity Integer { "unit": "%", "min": 0, "max": 100, "scale": 0, "step": 1 }
temp_current Integer { "unit": "℃", "min": 0, "max": 1400, "scale": 1, "step": 1 }
temp_unit_convert Enum { "range": [ "c", "f" ] }
battery_state Enum { "range": [ "low", "middle", "high" ] }
battery_percentage Integer { "unit": "%", "min": 0, "max": 100, "scale": 0, "step": 1 }
RLB7777 commented 1 year ago

Same for me. Soil sensor shows “unsupported” but all the data are in the diagnostics. The product code for the Zigbee sensor is zwjcy

badmadscientist commented 1 year ago

Hello it seems progress was made; i looked at the sensor.py and it has the soil update; my question is, how do I get this into my homeassistant?

HomeAssistant 2023.7.3 Supervisor 2023.07.1 Operating System 10.3 Frontent 20230705.1 - latest

I followed some instructions to create config/custom_components/tuya/sensor.py and reboot, but it had no effect.

I would be very glad of some assistance, as I really do want to get this sensor working

-Thanks!