Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions homeassistant/components/tuya/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -947,6 +947,7 @@ class DPCode(StrEnum):
UP_DOWN = "up_down"
UPPER_TEMP = "upper_temp"
UPPER_TEMP_F = "upper_temp_f"
USE_TIME_ONE = "use_time_one" # Single use time of irrigation
Comment thread
epenet marked this conversation as resolved.
Outdated
UV = "uv" # UV sterilization
UV_INDEX = "uv_index"
UV_RUNTIME = "uv_runtime" # UV runtime
Expand Down Expand Up @@ -979,6 +980,7 @@ class DPCode(StrEnum):
WIRELESS_ELECTRICITY = "wireless_electricity"
WORK_MODE = "work_mode" # Working mode
WORK_POWER = "work_power"
WORK_STATE = "work_state" # Irrigation device state (auto, manual, idle)
Comment thread
epenet marked this conversation as resolved.
Outdated
WORK_STATE_E = "work_state_e"


Expand Down
7 changes: 7 additions & 0 deletions homeassistant/components/tuya/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,13 @@
),
DeviceCategory.SFKZQ: (
# Controls the irrigation duration for the water valve
NumberEntityDescription(
key=DPCode.COUNTDOWN,
translation_key="irrigation_duration",
device_class=NumberDeviceClass.DURATION,
entity_category=EntityCategory.CONFIG,
),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the COUNTDOWN entity from this PR

There is a general opinion within the HA core team that these are invalid, and that the other existing countdown entities should be removed.

If you wish to press ahead please do so in a dedicated PR for just the COUNTDOWN entity.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the clarification — understood, I’ll remove COUNTDOWN from this PR.

Could you point me to where this team decision/discussion is documented? I’d like to better understand the rationale, since for this Tuya sfkzq water timer the countdown is functionally important in practice.

On this device, commands from Home Assistant/Alexa currently run with a default of 10 minutes, while only the Tuya/Smart Life app can set a custom duration via countdown. From a user perspective, exposing that value in HA would be very useful.

If the preferred path is a dedicated PR just for COUNTDOWN, I’m happy to prepare that — I just want to align with the expected model first.

@epenet epenet May 11, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically:

  • if the COUNTDOWN data point represents a status (remaining time until auto-stop) => it should be a timestamp sensor (with the expected finish time)
  • if it represents an action (start irrigation for x seconds/minutes) => it should be an action
  • if it represents a configuration value only (it represents a duration but the start is initiated by a different action) then number entity MIGHT be accepted

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if it represents a configuration value only (it represents a duration but the start is initiated by a different action) then number entity MIGHT be accepted

that's actually the case here, the countdown represents the irrigation duration but the valve needs to be opened by a separate action. Once the valve is open, the countdown indication when it closes again.
I'll create an extra PR and we'll see how it goes.

Thank you so much for your review, tips and explanations 🚀

# Controls the irrigation duration for indexed water valves
Comment thread
epenet marked this conversation as resolved.
Outdated
NumberEntityDescription(
key=DPCode.COUNTDOWN_1,
translation_key="indexed_irrigation_duration",
Expand Down
14 changes: 14 additions & 0 deletions homeassistant/components/tuya/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,20 @@ class TuyaSensorEntityDescription(SensorEntityDescription):
state_class=SensorStateClass.TOTAL_INCREASING,
entity_category=EntityCategory.DIAGNOSTIC,
),
TuyaSensorEntityDescription(
key=DPCode.USE_TIME_ONE,
translation_key="last_watering_time",
device_class=SensorDeviceClass.DURATION,
native_unit_of_measurement=UnitOfTime.SECONDS,
Comment thread
epenet marked this conversation as resolved.
Outdated
entity_category=EntityCategory.DIAGNOSTIC,
),
TuyaSensorEntityDescription(
key=DPCode.WORK_STATE,
translation_key="irrigation_status",
device_class=SensorDeviceClass.ENUM,
entity_category=EntityCategory.DIAGNOSTIC,
options=["auto", "manual", "idle"],
Comment thread
epenet marked this conversation as resolved.
Outdated
),
*BATTERY_SENSORS,
),
DeviceCategory.SGBJ: BATTERY_SENSORS,
Expand Down
14 changes: 14 additions & 0 deletions homeassistant/components/tuya/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@
"inverter_output_power_limit": {
"name": "Inverter output power limit"
},
"irrigation_duration": {
"name": "Irrigation duration"
},
Comment thread
epenet marked this conversation as resolved.
Outdated
"maximum_brightness": {
"name": "Maximum brightness"
},
Expand Down Expand Up @@ -706,12 +709,23 @@
"inverter_output_power": {
"name": "Inverter output power"
},
"irrigation_status": {
"name": "Status",
"state": {
"auto": "Automatic",
Comment thread
epenet marked this conversation as resolved.
Outdated
"idle": "[%key:common::state::idle%]",
"manual": "Manual"
Comment thread
epenet marked this conversation as resolved.
Outdated
}
},
"last_amount": {
"name": "Last amount"
},
"last_operation_duration": {
"name": "Last operation duration"
},
"last_watering_time": {
"name": "Last watering time"
},
"lifetime_battery_charge_energy": {
"name": "Lifetime battery charge energy"
},
Expand Down
Loading
Loading