-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Added new Tuya SGW08Z Dual water valve #8898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/devices/tuya.ts
Outdated
| onEvent: tuya.onEventSetTime, | ||
| configure: tuya.configureMagicPacket, | ||
| exposes: [ | ||
| e.enum("valve_status_1", ea.STATE, ["manual", "auto", "idle"]).withDescription("Valve 1 status (manual, auto, idle)"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| e.enum("valve_status_1", ea.STATE, ["manual", "auto", "idle"]).withDescription("Valve 1 status (manual, auto, idle)"), | |
| e.enum("valve_status_l1", ea.STATE, ["manual", "auto", "idle"]).withDescription("Valve 1 status (manual, auto, idle)"), |
Does this make sense to keep it consistent with switch l1/l2?
|
the same device is also sold with the manufactor id _TZE284_fhvpaltk. Possibility to add this id too? |
|
Thanks! |
Just trying to get exactly this working with the latest dev build. Power is not reported, the device also has only 2 batteries (not 4 as the other one) -> might this be the reason that no battery state is reported? Also, while it reads the state, countdown, etc. correctly, activation of the valves only works manually via the button, not via Zigbee. @Jaegerstefan : Do you see similar issues with your device? |
|
also the getState buttons just expose an error -> z2m: No converter available for 'get' 'state' (undefined) |
|
I see the same with my SGW08Z, you cannot control the valves through zigbee, I only see feedback from pressing the buttons on the device. |
|
I’m using the _TZE284_fhvpaltk iteration of the TS0601 watering device and I’m trying to set it up in Home Assistant. Could anyone provide guidance on how I can get this working? I’ve created a question on the forums, and any assistance would be greatly appreciated! |
|
@Giulio-Ladu you need to switch to |
Ah I see, thank you! I will await an update :) |
|
Hey, I have the _TZE284_fhvpaltk and i switched to z2m edge. The device is now added but i cant switch the two switches. it get the update if i change manually at the device but if i change it in HA the state_l1 or 2 toggle but the valve_status_l1/2 stays on idle not manual |
I had the exact same issue with After a lot of debugging, I created a custom external converter that fully fixes this behavior. The key was avoiding ✅ Working features:
💾 Converter (drop this in
|
|
Can confirm this works, though the "last time it ran xxx seconds" is gone in contrast to the build-in converter. Question: Shouldn't it show "auto" if controlled via Zigbee instead of "manual" == button press? |
|
Thanks for confirming it works!
So it may depend on the firmware or valve revision. You could test the actual DP values using |
|
Hi, The device is now shown as supported through the external definition file, however there is not actual link between what's shown in z2m and the physical device. Most exposed properties have a state of 'null'. Only the valve_11/12 have a non-null status, however this is not linked to the device as changing the state in z2m won't affect the device, nor will pressing the button be reported in z2m. Any ideas what could be it? How can I help to get this to work? What were the things you played around with? |
Hey, thanks for testing it out and for the detailed feedback! I ran into exactly the same issue in earlier iterations — the device showing up, but no actual control or sync between Z2M and the physical valves. Here's what helped in my case: ✅ I made sure I'm on the latest Zigbee2MQTT dev build (Edge) ✅ I used the
✅ It’s important the 👇 How you can help debug:
Once we know the correct datapoints for your device variant, I can help you adapt the converter file. Happy to collaborate on this — it took me a while to get it stable too 😅 Let me know! |
|
Hi @samking86, Sorry for the delay in responding. I've got my z2m running in proxmox and have been trying to figure out how to change from release V2.3.0 to the latest Edge. I haven't found a simple way to so yet so would appreciate any tips on how to do so. In the meantime I've had a play with the device anyway, here is what I get in the log file: In case it may be helpful, here's the database.db entry for my device: Let me know where to from here. |
|
Hi, just adding that I used the /config/zigbee2mqtt/external_converters/ts0601_valve_custom.js script above today (24 May 2025) in Z2M version: 2.3.0-1 on my _TZE284_fhvpaltk and it was immediately detected and exposed both valves, the countdown timers, status and battery levels. thank you for the work on this. |
|
Hi @samking86, Just a quick update. Not sure what happened but for some reason it seems to be working now. I once again clicked on the valve in the dashboard to open it but then got distracted and after about 20s the physical valve responded. Having activated it a few more times, it seems that it is now working as expected, the valves can be manually triggered from Z2m, and the activation delay is now down to 5s. Thanks for all your work and sorry for the troubles. |
|
I also dropped the above code into /config/zigbee2mqtt/external_converters/ts0601_valve_custom.js but it still doesn't expose anything... do I need something else? (I have Z2M in HA) `const exposes = require('zigbee-herdsman-converters/lib/exposes'); const e = exposes.presets; const ea = exposes.access; const tuya = require('zigbee-herdsman-converters/lib/tuya');` can I circumvent this, since I don't have this package installed, since Im on HA installtion? |
|
Hi @LarsOde, I ended up moving my external_converters from the location that you have it, to .../zigbee2mqtt/data/external_converters and then it was able to load the .js and which did the trick for me and now it shows as I don't know anything about the constants so can't comment on that part. |
|
@Koenkk |
|
Can someone make a PR for this?
|
|
Hi, when placing samking86's adapter in external_extensions, z2m rejects it and renames it to .invalid. Also, the adapter hasn't made it to z2m edge yet right ? Home Assistant OS
|
|
Just as per the instruction, External converter worked for me too. No need to add any lines to configuration.yaml file (chatGPT suggests that you have to). And also calling it "external" - works, rather than "custom". Also using latest Zigbee2MQTT Edge (if not latest for you, delete it and install again) |
|
what i notice, most of it works, few things not, like setting the watering duration, also state of switches doesn't update always |
|
I use the external converter from @samking86 . I see changes while pressing buttons on the device - but can't remote control the device. This is what is shown in the logs: info 2025-06-13 20:37:24z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/0x0c2a6ffffea22309', payload '{"battery":null,"countdown_l1":9,"countdown_l2":3,"last_seen":"2025-06-13T20:37:00+02:00","linkquality":109,"state_l1":"ON","state_l2":"ON","valve_duration_l1":77,"valve_duration_l2":452,"valve_status_l1":"idle","valve_status_l2":"idle","voltage":null}'
Any ideas what I need to change? |
|
@SnowZucc Did you resolved your problem? I habe the same issue and i'm not able to get it working. Home assistant with Zigbee2MQTT and all without docker container. I can see it changes the countdown_l1 and countdown_l2 but it is not running and the status always stays "idle". |
|
I moved it back to Tuya... need the stuff working in summer ;) |
|
Thanks for the reply. An other ideas or tips? I would prefer to make it work with HA |
|
oh, it's still in HA... I have my humidity sensors still in MQTT, only moved the water tap to Tuya, and use that with the Tuya integration |
|
I have the same problems, after adding the device to z2m all works ok. If switch is changed to on the state changes to manual and all works. After 1-2 days it do not works anymore. I have 3 devices and all have the same behaviour. Strange side node, I have a similar behaviour with a fan aswell. Add it new and all works fine. After a few days all works, only the on/off switch do not work. All other settings are working as expected. (WLAN connected via Tuya ) |
|
For me it was working no time at all. It never opened the valve or changed the status to auto |
|
@MadAimBln sadly no, my z2m still rejects the .js adapter and I have not found why |
|
Ok the original config from z2m edge do not work for me. Like you discribed the state do not change. But I used @samking86 solution and added the duration in it. This seems to work. To be sure I first added the converter file, then deleted the added valve devices restart z2m and added devices new. I had some problems in the past, that it stops working after a period but atm it works. File: zigbee2mqtt/external_converters/ts0601_value.js const exposes = require('zigbee-herdsman-converters/lib/exposes');
const e = exposes.presets;
const ea = exposes.access;
const tuya = require('zigbee-herdsman-converters/lib/tuya');
module.exports = {
fingerprint: [
{
modelID: 'TS0601',
manufacturerName: '_TZE284_fhvpaltk',
},
],
model: 'TS0601_valve_custom',
vendor: 'Tuya',
description: 'Custom working dual water valve with _l1/_l2 naming',
fromZigbee: [tuya.fz.datapoints],
toZigbee: [tuya.tz.datapoints],
exposes: [
e.binary('valve_l1', ea.STATE_SET, 'ON', 'OFF'),
e.binary('valve_l2', ea.STATE_SET, 'ON', 'OFF'),
e.numeric('countdown_l1', ea.STATE_SET).withValueMin(0).withValueMax(255).withUnit('min'),
e.numeric('countdown_l2', ea.STATE_SET).withValueMin(0).withValueMax(255).withUnit('min'),
e.enum('valve_status_l1', ea.STATE, ['idle', 'manual', 'remote']),
e.enum('valve_status_l2', ea.STATE, ['idle', 'manual', 'remote']),
e.numeric("valve_duration", ea.STATE).withUnit("s").withDescription("Valve 1 irrigation last duration in seconds").withEndpoint("l1"),
e.numeric("valve_duration", ea.STATE).withUnit("s").withDescription("Valve 2 irrigation last duration in seconds").withEndpoint("l2"),
e.numeric('battery', ea.STATE).withUnit('%'),
],
meta: {
tuyaDatapoints: [
[1, 'valve_l1', tuya.valueConverter.onOff],
[2, 'valve_l2', tuya.valueConverter.onOff],
[13, 'countdown_l1', tuya.valueConverter.countdown],
[14, 'countdown_l2', tuya.valueConverter.countdown],
[25, "valve_duration_l1", tuya.valueConverter.raw], // Valve 1 duration
[26, "valve_duration_l2", tuya.valueConverter.raw], // Valve 2 duration
[104, 'valve_status_l1', tuya.valueConverterBasic.lookup({
idle: tuya.enum(2),
manual: tuya.enum(0),
remote: tuya.enum(1),
})],
[105, 'valve_status_l2', tuya.valueConverterBasic.lookup({
idle: tuya.enum(2),
manual: tuya.enum(0),
remote: tuya.enum(1),
})],
[59, 'battery', tuya.valueConverter.raw],
],
},
};
` |
|
I have still the same issue. The js file is renamed with invalid after restart of zigbee2mqtt. Home Assistant without docker. With Zigbee2MQTT AddOn ''' z2m: Failed to load external extension 'ts0601_value.js'. Check the code for syntax error and make sure it is up to date with the current Zigbee2MQTT version. |
|
Can you try to use the edge Version? ( Separat z2m Edge addon . You have to stop the normal addon and Install the Edge addon) |
|
I just tried using z2m Edge, and it still renames it to invalid for me. Using the latest Edge version that I just downloaded |
|
Same here. Z2m edge and renamed to invalid. And via GUI ts0601_value.js contains invalid code: mod is not a constructor z2m: Failed to load external extension 'ts0601_value.js'. Check the code for syntax error and make sure it is up to date with the current Zigbee2MQTT version. |
|
Can confirm, the code of @Aenos85 is working in device-tab and Homeassistant, but not in dashboard. But the dashboard I never used. If some more can confirm, that the code is working, I could make a pull-request so the not-working-code is replaced. Is there someone also having "_TZE284_8zizsafo" or "_TZE284_iilebqoo"? Think, these can also use this code, because they are having the same datapoints. If someone can confirm the code is also working with these devices, we can merge the codes and white-label these devices. |
|
Any idea what to do? |
I've used the same code and it is working both on Z2M and simple automation (on/off valve). |
|
@rejo007 Doesn't work for me :-( How/where did you debug? Need to get this thing running before holiday :-) |
|
I used @wariosc 's code and it works. p.s.: first I needed to pull latest from github (was 2.4.0, now is 2.5.1) |
|
hm, minor flaw gone. Now ui button state always = valve state. Maybe it was a browser cache issue. |
|
It works good. Thank you very much. |
|
Did you find a way to make it work properly? |
|
not used mine for several weeks and switched both valves on and off now without problem |
Nice, thanks! It might be due to the link quality in my device 👍 I'll see in some weeks |
After connecting the device to a closer router it seems to be working fine now. |



Device: Insoma SGW08Z
type: _TZE284_eaet5qt5
based on this PR: zigpy/zha-device-handlers#3556