Skip to content
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

Fix GiEX QT06 water valve units #4929

Merged
merged 1 commit into from
Nov 12, 2022
Merged

Fix GiEX QT06 water valve units #4929

merged 1 commit into from
Nov 12, 2022

Conversation

drakhart
Copy link
Contributor

@drakhart drakhart commented Nov 11, 2022

I made some fixes and improvements to the GiEX QT06 water valve:

  • Replaced minutes with seconds. I realized that this device measures in seconds as soon as I set 2 irrigation cycles of 1 minute each with 1 minute interval and it just went crazy with instant on and offs. I set 60 "minutes" instead and it behaved as expected.
  • Adjusted the max values to 3600 (seconds in an hour) because the existing 1440 (minutes in a day) didn't make sense anymore and setting 86400 (seconds in a day) just sounded ridiculous to me.
  • Spelled litres instead of Litres as uppercase is just for the abbreviation (L).
  • Removed some unnecessary units, especially the incorrect GMT+8 for times as the device uses GMT (Zulu time).
  • Improved some descriptions, especially those referring to last irrigation info.

@Koenkk Koenkk merged commit 032a187 into Koenkk:master Nov 12, 2022
@Koenkk
Copy link
Owner

Koenkk commented Nov 12, 2022

Thanks!

Mephistofeles pushed a commit to Mephistofeles/zigbee-herdsman-converters that referenced this pull request Dec 13, 2022
@dgaust
Copy link

dgaust commented Jan 7, 2023

Is it 100% certain that the values for time are seconds? I just received this device, and setting the run time in seconds (i.e 2 seconds) results in the device running for 2 minutes.

The UI in the app only allows setting duration as minutes. And to confirm, when you set the duration in the app, the start and finish time is adjusted in minutes and not seconds. From the UI, I set the duration to 1s and the start and end time is exactly a minute apart.

image

And then on completion of the sequence, the last irrigation duration is shows minutes

image

@drakhart
Copy link
Contributor Author

drakhart commented Jan 7, 2023

I have four of these valves at home, and all four take the time value in seconds. They were bought in batches of two from this store. As a side note, they have never been paired with any app other than zigbee2mqtt.

Here are some screenshots as proof:
image
image
image
image

That being said, I don't doubt what you're saying so let's try and find a logic explanation for this difference:

  • Did you buy yours from a different vendor?
  • Could it be that some batches of units display a different behavior? Maybe based on serial number, I'll try to dig that info.
  • Could it be that the firmware was updated after pairing them to the official app, and their behavior changed from then on?

@dgaust
Copy link

dgaust commented Jan 7, 2023

I bought mine from Amazon https://www.amazon.com.au/dp/B0B1JN6KZX?ref=ppx_yo2ov_dt_b_product_details&th=1

I've only paired this device to zigbee2mqtt, and not any other app, so it has the firmware it was shipped with (it's not showing the firmware version in zigbee2mqtt either).

I've ordered a tuya gateway today, so once that arrives (probably wont be for a month), I'll hopefully be able to see more details and update any firmware if necessary.

edit: This is a screenshot of what is being identified in zigbee2mqtt

image

@tonimgp
Copy link

tonimgp commented Jan 13, 2023

I need to modify the mcu and know in which gpio each component is connected.
Can you help me?

I want to use the device as a water meter at the entrance of the house

@dgaust
Copy link

dgaust commented Jan 17, 2023

I've only paired this device to zigbee2mqtt, and not any other app, so it has the firmware it was shipped with (it's not showing the firmware version in zigbee2mqtt either).

I've ordered a tuya gateway today, so once that arrives (probably wont be for a month), I'll hopefully be able to see more

Just circling back to this one, I received the gateway today and have paired it with the GeIX device. Unfortunately there are no firmware updates (currently on v1.06 for Zigbee and V1.0.0 for the MCU module), so I'm stuck with minutes as the most granual time I can set on the device.

@drakhart
Copy link
Contributor Author

I don't know what to say, I don't have any logic explanation as to why all my units work in seconds.... but since both the 1st commiter and you have your units in minutes maybe it's better to revert that specific change. Of course that's not gonna fix the time granularity for you, it's just that the UI will make sense.

@dgaust
Copy link

dgaust commented Jan 20, 2023

I've ordered another one from aliexpress this time. Will see what happens when it arrives.

@Knoedelauflauf
Copy link

I also received a new device today, ordered from amazon us. The device uses minutes instead of seconds, the granularity would be nice, but is not a hard requirement. May I help somehow?

@stevewull
Copy link

I also received a new device today, ordered from Amazon US. It uses minutes. Based on my reading of this thread and #13487, it appears that there are two versions:

  1. Amazon US. Uses Minutes. Manufacturer appears as: _TZE200_sh1btabb

  2. Aliexpress version. Uses seconds. manufacturer appears as: _TZE200_a7sghmms

(I'm guessing based on the posts...I do not have an aliexpress version to confirm.) I plan to order some from ali in the future.

@stevewull
Copy link

stevewull commented Feb 14, 2023 via email

@fedegrc
Copy link

fedegrc commented Feb 28, 2023

Hi, my GiEX QT06 manufacturer _TZE200_a7sghmms works as described by @drakhart, the values for time are seconds. I bought it in https://www.aliexpress.com/item/1005004222098040.html
Following a picture of the hardware version:
1677625180691
How can I see the GiEX firmware version in Z2M?

@WhimsySpoon
Copy link

WhimsySpoon commented Mar 6, 2023

I have a _TZE200_sh1btabb from AliExpress

irrigation_target (when mode set to duration) is in minutes.

last_irrigation_duration is reported in seconds.

irrigation_start_time and irrigation_end_time values are out as they are showing as GMT+8.

@WhimsySpoon
Copy link

I have created an external converter using the previous version of giex.js and everything is now working as it should.

@Koenkk
Copy link
Owner

Koenkk commented Mar 6, 2023

@WhimsySpoon can you provide me the external converter? Then I can integrate the fix.

@WhimsySpoon
Copy link

WhimsySpoon commented Mar 6, 2023

@Koenkk I literally just copied the contents of giex.js out of the "before" in the diff of this PR and created an external converter from it. Essentially just rolling back the PR (attached as a text file).

I was wondering if we could create two files, the only difference being the device fingerprint. I know it would be a lot of duplicated code, but it would get the job done. If it's just a case of this, I'd be happy to raise the PR myself.

Also, is there anything we could do with the irrigation_start_time and irrigation_end_time timestamps to make them local?

giex.txt

@fedegrc
Copy link

fedegrc commented Mar 7, 2023

Removed some unnecessary units, especially the incorrect GMT+8 for times as the device uses GMT (Zulu time).

@drakhart, remove the GMT+8 is ok for _TZE200_a7sghmms. However, my Z2M is showing my localtime, which is not GMT. Should we remove (GMT) the in the description?

Last irrigation start time (GMT) --> Last irrigation start time
Last irrigation end time (GMT) --> Last irrigation end time

Also, it would be great to have the date and time instead of just the time.

@WhimsySpoon
Copy link

WhimsySpoon commented Mar 7, 2023

@fedegrc Is your local time GMT+8 by any chance? This is what seems to be hard-coded in the devices.

@fedegrc
Copy link

fedegrc commented Mar 7, 2023

@fedegrc Is your local time GMT+8 by any chance? This is what seems to be hard-coded in the devices.

My local time is GMT-3.

@fedegrc
Copy link

fedegrc commented Mar 7, 2023

We have detected the following differences so far:

  • _TZE200_sh1btabb: Uses Minutes. Timezone is GMT+8
  • _TZE200_a7sghmms: Uses seconds. Timezone is local

@Koenkk
Copy link
Owner

Koenkk commented Mar 7, 2023

@drakhart do I understand correctly that different units are used across devices?

@drakhart
Copy link
Contributor Author

drakhart commented Mar 7, 2023

@drakhart, remove the GMT+8 is ok for _TZE200_a7sghmms. However, my Z2M is showing my localtime, which is not GMT. Should we remove (GMT) the in the description?

IMO yes, it'd be better to have no suffix than having the wrong one.

@drakhart do I understand correctly that different units are used across devices?

Apparently this is the case, according to the findings in this thread. Unfortunately for me all four units I own are _TZE200_a7sghmms, so I can't compare myself. Anyway it looks like I should have been more cautious before assuming that the original units were wrong and changing them.

@stevewull
Copy link

stevewull commented Mar 8, 2023

I have three of the _TZE200_sh1btabb version. Irrigation target is in minutes.

I live at GMT -08:00 Time zone (Americas/Pacific) Although daylight savings time adjustment is a week away.

The irrigation_start_time seems to be GMT +08:00, not the local time zone. This is what shows in Z2M and my Home Assistant entity.

@Koenkk
Copy link
Owner

Koenkk commented Mar 8, 2023

@drakhart I see, could you make a PR to fix the issues?

@WhimsySpoon
Copy link

Could we also have something along the lines of, but not as hacky as the following to handle the timezone conversion?

//times from device hard-coded to GMT+8
let startTime = new Date(Date.parse("1900-01-01 " + value + " GMT+0800"));

return {irrigation_start_time: startTime.toTimeString().split(' ')[0]};

@drakhart
Copy link
Contributor Author

drakhart commented Mar 8, 2023

@drakhart I see, could you make a PR to fix the issues?

Sure, I'll try my best.

Could we also have something along the lines of, but not as hacky as the following to handle the timezone conversion?

I'll look into something, though I'm not sure I'll be able to find any solution less "hackier" than yours.

BTW, @fedegrc, are you absolutely sure about _TZE200_a7sghmms reporting your local GMT-3 time out of the box? I own four of those and all of them are reporting GMT/Zulu, in fact I'm doing the conversion to my local time (GMT+1) inside Home Assistant.

@WhimsySpoon
Copy link

I have something working on my custom converter. I'll upload it tomorrow.

@fedegrc
Copy link

fedegrc commented Mar 10, 2023

In the next PR I would like the maximum irrigation time to be changed.

I think we should go back from 3600 to 1440 to the max irrigation_target in the _TZE200_sh1btabb (uses minutes).

Regarding the _TZE200_a7sghmms (uses seconds), I did some tests to get the maximum irrigation_target value accepted and I found that it is 65535. We can put that value, or round to 43200 (12hs) or 64800 (18hs).

I can't confirm, but surely cycle_irrigation_interval also has a maximum of 65535.

@fedegrc
Copy link

fedegrc commented Mar 10, 2023

@Koenkk, to integrate the water consumption sensor in the home-assistant energy dashboard, we need to add the following (ha doc):

  • state_class: total_increasing
  • device_class: water

Can it be set in the device's herdsman-converters?

@Koenkk
Copy link
Owner

Koenkk commented Mar 11, 2023

@fedegrc this applies to the water_consumed sensor right?

@fedegrc
Copy link

fedegrc commented Mar 11, 2023

@Koenkk , yes, this applies to the water_consumed sensor.

@drakhart
Copy link
Contributor Author

New PR opened: #5567

Please have a look, @fedegrc and @WhimsySpoon, to see if this addresses your suggestions/requests.

@drakhart
Copy link
Contributor Author

BTW, can anyone with the _TZE200_sh1btabb confirm if the box states "Thread: NH"? For _TZE200_a7sghmms it says "Thread: BSP". That makes me think that the B in the QT06-B-Z-V3.0 motherboard pic shared by @fedegrc could stand for QT06 BSP ZigBee 3.0.

If it's like this we can give these two models more friendly names, like QT06-BSP/QT06-NH or just QT06-B/QT06-N.

@WhimsySpoon
Copy link

@drakhart isn't the Thread to do with the pipe fitting? Unfortunately I don't still have the box.

https://arthurharris.com/news/npt-vs-bsp/

@drakhart
Copy link
Contributor Author

@drakhart isn't the Thread to do with the pipe fitting? Unfortunately I don't still have the box.

@WhimsySpoon in theory yes, it should only have to do with the pipe fitting, but that B printed on _TZE200_a7sghmms's motherboard is very sus. Would you mind opening the plastic cover of your _TZE200_sh1btabb unit and taking a look to make sure? Of course only if you are comfortable with it; I understand that not everyone is.

@WhimsySpoon
Copy link

@drakhart no problem at all. Is this what you're after?

image

@drakhart
Copy link
Contributor Author

@drakhart no problem at all. Is this what you're after?

Yes, thank you. Unfortunately that's exactly the same naming as on @fedegrc's _TZE200_a7sghmms, so I still don't know what does it make a difference for this device to have two different models.

@WhimsySpoon
Copy link

I wonder if it refers to a different component, the valve for instance. But it does seem odd that there are software differences. I wonder if it's worth emailing GIEX to see if they'll explain.

@drakhart
Copy link
Contributor Author

I don't feel the need to: I think we're covered for now, thanks to you and the rest of people who reported info about the different variants.

@WhimsySpoon
Copy link

I did actually message them shortly after my response above. The following is what I received a few hours ago. Based on their response around the min irrigation time, it looks like _TZE200_a7sghmms is the latest version.

I've replied and asked if they would be able to provide a firmware update to bring all devices in line with the latest

Hello. This is a different batch of product. The firmware is constantly being improved. One has a minimum irrigation time in minutes and one has a minimum irrigation time in 10 seconds.

The device in the warehouse now has a minimum irrigation time of 10s.

@fedegrc
Copy link

fedegrc commented Mar 13, 2023

Maybe those 10 seconds are to avoid some mechanical problem in the valve. It might be better to change the minimum time to 10 seconds for _TZE200_a7sghmms. That is, that the possible values are 10, 11, 12, ..., 43200.

If the _TZE200_a7sghmms is the latest version, it may be more consistent to swap the names:

_TZE200_sh1btabb --> QT06_1
_TZE200_a7sghmms --> QT06_2

@WhimsySpoon
Copy link

Unfortunately, they've just confirmed that the firmware isn't ugpradable on these devices.

@drakhart
Copy link
Contributor Author

Maybe those 10 seconds are to avoid some mechanical problem in the valve. It might be better to change the minimum time to 10 seconds for _TZE200_a7sghmms. That is, that the possible values are 10, 11, 12, ..., 43200.

Yes, makes sense, if they updated the device to work like this they must have a good/valid reason. Unfortunately it's not as easy as setting the minimum value to 10: we'd be breaking the 0 value which means "do not turn off until manually told to do so". Also we need to check if the device is in duration mode, as it shouldn't affect the capacity one. Tricky, but I'll try.

If the _TZE200_a7sghmms is the latest version, it may be more consistent to swap the names:

_TZE200_sh1btabb --> QT06_1 _TZE200_a7sghmms --> QT06_2

👍

@drakhart
Copy link
Contributor Author

Good news, @fedegrc: I managed to implement the minimum 10 seconds duration for _TZE200_a7sghmms.

@WhimsySpoon
Copy link

As expected, they have confirmed that _TZE200_a7sghmms is the latest version of the two.

@Giexperience
Copy link

Hello. I am the manufacturer of GIEX water valves. Our factory has recently launched a new water valve this year, known as the GX-02 model. This new design addresses the user feedback issues from the QT06. I have observed that many users wish to integrate the new water valve with 2MQTT and ZHA. Unfortunately, I am merely a manufacturer of water valves, and my company lacks experts in 2MQTT and ZHA. I am unable to accomplish this task. Therefore, I would like to kindly request your assistance. Could you help me in adding it to 2MQTT and ZHA? I can send you a completely new sample of our latest water valve.

Allow me to share some details about our new GX-02 water valve. We collaborated with professional designers to give it a more stylish and compact appearance, addressing the bulkiness seen in the QT06. The design features a pull-out battery compartment for convenient battery replacement. The new model utilizes an integrated pipeline design to reduce the risk of malfunctions and leaks. We've also incorporated a design with plastic wrapping around the copper connectors. This not only maintains durability but also makes it easier to tighten the valve without tools, preventing any harm to the hands. We have added a bright circular LED light as well, addressing feedback from QT06 users who found the red indicator light challenging to see.

I appreciate your consideration and assistance in this matter. Thank you!
My contact email is: GIEXSMART@126.COM

@Giexperience
Copy link

好消息,@fedegrc:我设法实现了 的最小 10 秒持续时间_TZE200_a7sghmms

It has now been implemented that watering can be done in as little as 1 second. in tuya app.

@WhimsySpoon
Copy link

@Giexperience Is the device available to purchase on Ali Express yet? Could you share a link please?

@Giexperience
Copy link

Giexperience commented Mar 1, 2024 via email

@dgaust
Copy link

dgaust commented Mar 3, 2024

I ordered one to replace one of the earlier versions. Hopefully a simple tweak to integrate it

@dgaust
Copy link

dgaust commented Mar 14, 2024

I received mine the other day, seems a lot more robust that the previous version and a fair bit smaller as well. I was able to get it running in zigbee2mqtt using the below in an external converter file. It's basically just the same as the existing version that has the seconds firmware, but with a different device name.

There are some slightly additional statuses available, but they don't appear to be that useful (i.e. temperature always returns zero).

const exposes = require('zigbee-herdsman-converters/lib/exposes');
const extend = require('zigbee-herdsman-converters/lib/extend');
const e = exposes.presets;
const ea = exposes.access;
const tuya = require('zigbee-herdsman-converters/lib/tuya');
const legacy = require('zigbee-herdsman-converters/lib/legacy');
const MINUTES_IN_A_DAY = 1440;
const SECONDS_IN_12_HOURS = 43200;

module.exports = [
    {
        fingerprint: [
            {modelID: 'TS0601', manufacturerName: '_TZE204_7ytb3h8u'},
        ],
        model: 'GX02',
        vendor: 'GiEX',
        description: 'GX02 GiEX Water Valve',
        extend: [],
        meta: {},
        onEvent: tuya.onEventSetLocalTime,
        fromZigbee: [legacy.fromZigbee.giexWaterValve],
        toZigbee: [legacy.toZigbee.giexWaterValve],
        exposes: [
            e.battery(),
            e.binary(legacy.giexWaterValve.state, ea.STATE_SET, 'ON', 'OFF')
                .withDescription('State'),
            e.enum(legacy.giexWaterValve.mode, ea.STATE_SET, ['duration', 'capacity'])
                .withDescription('Irrigation mode'),
            e.numeric(legacy.giexWaterValve.cycleIrrigationNumTimes, ea.STATE_SET)
                .withValueMin(0)
                .withValueMax(100)
                .withDescription('Number of cycle irrigation times, set to 0 for single cycle'),
            e.numeric(legacy.giexWaterValve.irrigationStartTime, ea.STATE)
                .withDescription('Last irrigation start time'),
            e.numeric(legacy.giexWaterValve.irrigationEndTime, ea.STATE)
                .withDescription('Last irrigation end time'),
            e.numeric(legacy.giexWaterValve.lastIrrigationDuration, ea.STATE)
                .withDescription('Last irrigation duration'),
            e.numeric(legacy.giexWaterValve.waterConsumed, ea.STATE)
                .withUnit('L')
                .withDescription('Last irrigation water consumption'),
            e.numeric(legacy.giexWaterValve.irrigationTarget, ea.STATE_SET)
                .withValueMin(0)
                .withValueMax(SECONDS_IN_12_HOURS)
                .withUnit('seconds or litres')
                .withDescription('Irrigation target, duration in seconds or capacity in litres (depending on mode), ' +
                    'set to 0 to leave the valve on indefinitely, ' +
                    'for safety reasons the target will be forced to a minimum of 10 seconds in duration mode'),
            e.numeric(legacy.giexWaterValve.cycleIrrigationInterval, ea.STATE_SET)
                .withValueMin(0)
                .withValueMax(SECONDS_IN_12_HOURS)
                .withUnit('sec')
                .withDescription('Cycle irrigation interval'),
        ],
    },
];

image

@dgaust
Copy link

dgaust commented Mar 17, 2024

yeah. This is the sales link on aliexpress. https://es.aliexpress.com/item/1005006547328147.html?gatewayAdapt=glo2esp#nav-moretolove | | GIEX-CINLIN-RAUL | | @.*** | ---- Replied Message ---- | From | @.> | | Date | 3/1/2024 20:35 | | To | @.> | | Cc | @.> , @.> | | Subject | Re: [Koenkk/zigbee-herdsman-converters] Fix GiEX QT06 water valve units (PR #4929) | @Giexperience Is the device available to purchase on Ali Express yet? Could you share a link please? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

The GX02 will be supported in the next release of Zigbee2MQTT

#7229

@WhimsySpoon
Copy link

Thanks for converter above, and submitting the code.

Have you noticed that when pressing the button on the GX02, the Irrigation End Time changes to --:--:-- until it's closed again, but when changing the state via Zigbee, it automatically changes to now, or now + irrigation target duration?

@dgaust
Copy link

dgaust commented Mar 18, 2024

It's expected behaviour from what I can tell. When you turn it in using the physical button it's manual watering, and so doesn't have a duration or capacity set. It's on until you turn it off.

@WhimsySpoon
Copy link

Ah, that makes sense. Thanks for the clarification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants