"""
Tuya QT-07S soil probe – _TZE284_oitavov2
DP map:
2 temperature-unit (0=C / 1=F)
3 soil-moisture %
5 temperature value ÷10 °C
14 battery-state enum 0/1/2
15 battery-percent %
"""
import zigpy.types as t
from zhaquirks.tuya.builder import TuyaQuirkBuilder
from zhaquirks.tuya import TUYA_CLUSTER_ID, TuyaPowerConfigurationCluster4AA
class TempUnit(t.enum8):
Celsius = 0
Fahrenheit = 1
class BatteryState(t.enum8):
Low = 0
Medium = 1
High = 2
(
TuyaQuirkBuilder("_TZE284_oitavov2", "TS0601")
# numeric sensors
#.tuya_temperature(dp_id=5, scale=10) # °C
.tuya_temperature(dp_id=5, scale=100) # °C, scale 100 to match the integer outputs to the centidegrees of tuyaquirkbuilder
.tuya_soil_moisture(dp_id=3) # %
.tuya_battery(dp_id=15, power_cfg=TuyaPowerConfigurationCluster4AA)
# read-only enums → select entities
.tuya_dp_attribute(dp_id=14, attribute_name="battery_state", type=t.enum8)
.enum(
attribute_name="battery_state",
cluster_id=TUYA_CLUSTER_ID,
enum_class=BatteryState,
translation_key="battery_state",
fallback_name="Battery state",
entity_platform = "sensor", # makes it a Sensor, not Select
)
.tuya_dp_attribute(dp_id=2, attribute_name="temperature_unit", type=t.enum8)
.enum(
attribute_name="temperature_unit",
cluster_id=TUYA_CLUSTER_ID,
enum_class=TempUnit,
translation_key="temperature_unit",
fallback_name="Temperature unit",
)
.skip_configuration()
.add_to_registry()
)
Basically it wasn't working so with minimal editing based on the Zigbee2MQTT side, and with the help of GPT O3 I got this. At least the moisture and temperature work fine now!
Just put it in the zha_quirks folder. I save it as moisturestick.py
. A reload of ZHA and it should show moisture first. Temperature only updates when the temperature changes so be patient; wait maybe half an hour.
Hope this is useful to other people too 😄
ZHA (Zigbee Home Automation) quirk code for Tuya Soil Moisture Sensor Stick
Tuya soil moisture sensor _TZE284_oitavov2 doesn't have ZHA integration for it yet. This quirk helps it work.