Add multi-valve support and rain sensor for irrigator (sfkzq)#6
Open
pgrootkop-cmyk wants to merge 1 commit intoDrenso:mainfrom
Open
Add multi-valve support and rain sensor for irrigator (sfkzq)#6pgrootkop-cmyk wants to merge 1 commit intoDrenso:mainfrom
pgrootkop-cmyk wants to merge 1 commit intoDrenso:mainfrom
Conversation
Adds support for multi-valve irrigation controllers (category sfkzq)
that report switch_1 through switch_4 instead of a single switch code.
Previously only battery_percentage was picked up during pairing.
Irrigator changes:
- Detect and map switch_1–switch_4 to individual valve capabilities
- Add master on/off toggle when multiple valves are present
- Preserve backward compatibility for single-switch irrigators
- Add rain_sensor capability using undocumented DP 49
- Translate numeric DP IDs to named codes in onTuyaStatus
- Add flow cards for per-valve actions, conditions, and triggers (EN/NL)
- Add valve naming translations (EN/NL)
MQTT fix:
- Pass numeric DP format (e.g. {"49":"rain"}) through to devices instead
of dropping them. The previous Number.isInteger check on string keys
always returned false, causing these data points to be logged as
malformed and discarded.
Tested on a 4-valve Intelligent Watering System (product dapc1pcplj7rxlw8).
All valves switch correctly, master toggle works, rain sensor state
updates via MQTT, and flow cards trigger as expected.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
bobvandevijver
requested changes
Mar 16, 2026
Member
bobvandevijver
left a comment
There was a problem hiding this comment.
Thank you for your PR, we have added it to our internal backlog for further processing as well. However, note that it cannot be merged as is due to the included datapoint addition.
|
|
||
| // Mapping of numeric DP IDs to Tuya codes for devices that report raw DP format via MQTT | ||
| export const IRRIGATOR_DP_ID_MAPPING: Record<string, string> = { | ||
| '49': 'rain_sensor_state', |
Member
There was a problem hiding this comment.
Data point value mappings are device specific and can therefor not be added to this generic driver.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
sfkzq) that reportswitch_1–switch_4instead of a singleswitchcode. Previously onlybattery_percentagewas exposed during pairing.rain_sensorcapability using undocumented DP 49, which reports rain state via MQTT in numeric DP format ({"49":"rain"}).Number.isIntegeron string keys always returnedfalse, so these data points were silently discarded.Changes
Irrigator driver:
switch_1–switch_4during pairing and map to individual valve on/off capabilitiesonTuyaStatusfor undocumented data pointsMQTT client (
TuyaHaClient.ts):{"49":"rain"}) is now passed through asstatus["49"] = "rain"instead of being dropped. Drivers can then resolve these IDs to named codes.Device info
Tested on: Intelligent Watering System (product
dapc1pcplj7rxlw8, categorysfkzq)Test plan
🤖 Generated with Claude Code