Open derekangl opened 5 months ago
logs Info 2024-05-31 20:31:21Succesfully interviewed '0xa4c13869455a3642' Info 2024-05-31 20:31:21Successfully interviewed '0xa4c13869455a3642', device has successfully been paired Info 2024-05-31 20:31:21Device '0xa4c13869455a3642' is supported, identified as: tuya water_valve here (TS0601_new) Info 2024-05-31 20:31:22MQTT publish: topic 'z2mR22/bridge/event', payload '{"data":{"definition":{"description":"water_valve here","exposes":[{"access":1,"category":"diagnostic","description":"Link quality (signal strength)","label":"Linkquality","name":"linkquality","property":"linkquality","type":"numeric","unit":"lqi","value_max":255,"value_min":0}],"model":"TS0601_new","options":[],"supports_ota":false,"vendor":"tuya"},"friendly_name":"0xa4c13869455a3642","ieee_address":"0xa4c13869455a3642","status":"successful","supported":true},"type":"device_interview"}' Info 2024-05-31 20:31:22Configuring '0xa4c13869455a3642' Info 2024-05-31 20:31:22MQTT publish: topic 'homeassistant/sensor/0xa4c13869455a3642/linkquality/config', payload '{"availability":[{"topic":"z2mR22/bridge/state","value_template":"{{ value_json.state }}"},{"topic":"z2mR22/0xa4c13869455a3642/availability","value_template":"{{ value_json.state }}"}],"availability_mode":"all","device":{"identifiers":["zigbee2mqtt_0xa4c13869455a3642"],"manufacturer":"tuya","model":"water_valve here (TS0601_new)","name":"0xa4c13869455a3642","via_device":"zigbee2mqtt_bridge_0x04cd15fffee45691"},"enabled_by_default":false,"entity_category":"diagnostic","icon":"mdi:signal","json_attributes_topic":"z2mR22/0xa4c13869455a3642","name":"Linkquality","object_id":"0xa4c13869455a3642_linkquality","origin":{"name":"Zigbee2MQTT","sw":"1.37.1-dev","url":"https://www.zigbee2mqtt.io"},"state_class":"measurement","state_topic":"z2mR22/0xa4c13869455a3642","unique_id":"0xa4c13869455a3642_linkquality_z2mR22","unit_of_measurement":"lqi","value_template":"{{ value_json.linkquality }}"}' Info 2024-05-31 20:31:22Successfully configured '0xa4c13869455a3642'
and
const fz = require('zigbee-herdsman-converters/converters/fromZigbee'); const tz = require('zigbee-herdsman-converters/converters/toZigbee'); const exposes = require('zigbee-herdsman-converters/lib/exposes'); const reporting = require('zigbee-herdsman-converters/lib/reporting'); const modernExtend = require('zigbee-herdsman-converters/lib/modernExtend'); const e = exposes.presets; const ea = exposes.access; const tuya = require('zigbee-herdsman-converters/lib/tuya');
const definition = { // Since a lot of TuYa devices use the same modelID, but use different datapoints // it's necessary to provide a fingerprint instead of a zigbeeModel fingerprint: [ { // The model ID from: Device with modelID 'TS0601' is not supported // You may need to add \u0000 at the end of the name in some cases modelID: 'TS0601', // The manufacturer name from: Device with modelID 'TS0601' is not supported. manufacturerName: '_TZE204_uab532m0', }, ], model: 'TS0601_new', vendor: 'tuya', description: 'water_valve here', fromZigbee: [tuya.fz.datapoints], toZigbee: [tuya.tz.datapoints], onEvent: tuya.onEventSetTime, // Add this if you are getting no converter for 'commandMcuSyncTime' configure: tuya.configureMagicPacket, exposes: [ // Here you should put all functionality that your device exposes ], meta: { // All datapoints go in here tuyaDatapoints: [ ], }, extend: [
// A preferred new way of extending functionality.
],
};
module.exports = definition;
I have the same valve and have found the tuya end point : {"1":"Switch", boolean "3":"Status", "type": "Enum", "values": "{\"range\":[\"off\",\"auto\",\"disabled\"]}" "5":"Countdown", "type": "Integer", "values": "{\"unit\":\"min\",\"min\":1,\"max\":240,\"scale\":0,\"step\":1}" "6":"Countdown Left", "type": "Integer", "values": "{\"unit\":\"min\",\"min\":1,\"max\":240,\"scale\":0,\"step\":1}" "9":"Water Current" "type": "Integer", "values": "{\"unit\":\"gal/min\",\"min\":0,\"max\":1000000000,\"scale\":3,\"step\":1}" "11":"Battery Percentage" "type": "Integer", "values": "{\"unit\":\"%\",\"min\":0,\"max\":100,\"scale\":0,\"step\":1}" "15":"Water Total" "type": "Integer", "values": "{\"unit\":\"gal\",\"min\":0,\"max\":999999999,\"scale\":3,\"step\":1}" "19":"Fault" "37":"Weather Delay", type enum {\"range\":[\"24h\",\"48h\",\"72h\",\"cancel\"]}" "38":"Normal Timer", "type": "String", "values": "{\"maxlen\":255}" "42":"Switch", boolean "47":"Smart Irrigation" "101":"Total flow reset switch", "102":"Quantitative watering", "103":"Flow switch"} "104":"Child lock" "105":"Surplus flow" "106":"Single watering time" "107":"Interface refresh", "108":"Amount of watering per time"}
I don't know to write the converter and need help
@dominique6017 are you familiar with https://www.zigbee2mqtt.io/advanced/support-new-devices/01_support_new_devices.html#_2-2-adding-converter-s-for-your-device ?
ohhh .... it seems it may already exist? https://github.com/Koenkk/zigbee-herdsman-converters/blob/da65b1aeffd96527df02725b49de61e453fee059/src/devices/neo.ts#L130 just needs some tweaking?
@dominique6017 and/or @derekangl could you test if https://github.com/Koenkk/zigbee-herdsman-converters/pull/7670 helps with the issue? I will be able to do it in at least a week, I cannot get to my sensor earlier :(
Hiya,
I have this valve from derekangl and came up with this converter, based on the Koenkk/zigbee-herdsman-converters#7670 NB zigbee-herdsman-converters update has not yet been merged. (latest v19.58.0). When playing with On / Off (working with 3 seconds delay), I see errors: Error 2024-06-22 02:52:20z2m: Exception while calling fromZigbee converter: Value '4' is not allowed, expected one of true,false} Error 2024-06-22 02:52:26z2m: Exception while calling fromZigbee converter: Value '0' is not allowed, expected one of true,false} Error 2024-06-22 02:52:27z2m: No converter available for 'get' 'state' () Error 2024-06-22 02:52:32z2m: Exception while calling fromZigbee converter: Value '3' is not allowed, expected one of true,false} Error 2024-06-22 02:53:02z2m: Exception while calling fromZigbee converter: Value '0' is not allowed, expected one of true,false} Error 2024-06-22 02:56:54z2m: No converter available for 'switch_enabled' ("ON") Error 2024-06-22 02:56:55z2m: No converter available for 'switch_enabled' ("OFF") Error 2024-06-22 02:57:00z2m: No converter available for 'total_flow_reset_switch' ("OFF") Error 2024-06-22 02:57:01z2m: No converter available for 'total_flow_reset_switch' ("ON") Error 2024-06-22 02:57:02z2m: No converter available for 'flow_switch' ("OFF") Error 2024-06-22 02:57:04z2m: No converter available for 'flow_switch' ("ON") Error 2024-06-22 02:56:45z2m: No converter available for 'get' 'state' () Error 2024-06-22 02:56:54z2m: No converter available for 'switch_enabled' ("ON") Error 2024-06-22 02:56:55z2m: No converter available for 'switch_enabled' ("OFF") Error 2024-06-22 02:57:00z2m: No converter available for 'total_flow_reset_switch' ("OFF") Error 2024-06-22 02:57:01z2m: No converter available for 'total_flow_reset_switch' ("ON") Error 2024-06-22 02:57:02z2m: No converter available for 'flow_switch' ("OFF") Error 2024-06-22 02:57:04z2m: No converter available for 'flow_switch' ("ON") Error 2024-06-22 03:32:49z2m: No converter available for 'weather_delay' ("24h")
Moreover, NULLS: Status Null Water current Current water flow (L/min) NullL/min Battery percentage Null% Water total Total water flow (L) NullL Fault Fault status Null Smart irrigation Null Surplus flow Null Single watering duration Null Single watering amount Null
External converter:
const fz = require('zigbee-herdsman-converters/converters/fromZigbee'); const tz = require('zigbee-herdsman-converters/converters/toZigbee'); const exposes = require('zigbee-herdsman-converters/lib/exposes'); const reporting = require('zigbee-herdsman-converters/lib/reporting'); const {} = require('zigbee-herdsman-converters/lib/modernExtend'); 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 definition = { fingerprint: tuya.fingerprint('TS0601', ['_TZE204_uab532m0']), zigbeeModel: ['NAS-WV03B'], model: 'NAS-WV03B_Jac', vendor: 'Neo', fromZigbee: [tuya.fz.datapoints], toZigbee: [tuya.tz.datapoints], description: 'Smart sprinkler timer', onEvent: tuya.onEventSetTime, configure: tuya.configureMagicPacket, exposes: [ e.switch(), e.enum('status', ea.STATE, ['off', 'auto', 'disabled']).withDescription('Status'), e.numeric('countdown', ea.STATE_SET).withUnit('min').withValueMin(1).withValueMax(240).withDescription('Countdown'), e.numeric('countdown_left', ea.STATE).withUnit('min').withValueMin(1).withValueMax(240).withDescription('Countdown left'), e.numeric('water_current', ea.STATE).withUnit('L/min').withValueMin(0).withValueMax(3785.41).withValueStep(0.001) .withDescription('Current water flow (L/min)'), e.numeric('battery_percentage', ea.STATE).withUnit('%').withValueMin(0).withValueMax(100).withDescription('Battery percentage'), e.numeric('water_total', ea.STATE).withUnit('L').withValueMin(0).withValueMax(378541.0).withValueStep(0.001) .withDescription('Total water flow (L)'), e.binary('fault', ea.STATE, 'DETECTED', 'NOT_DETECTED').withDescription('Fault status'), e.enum('weather_delay', ea.STATE_SET, ['24h', '48h', '72h', 'cancel']).withDescription('Weather delay'), e.text('normal_timer', ea.STATE_SET).withDescription('Normal timer'), e.binary('switch_enabled', ea.STATE_SET, 'ON', 'OFF').withDescription('Switch enabled'), e.numeric('smart_irrigation', ea.STATE).withDescription('Smart irrigation'), e.binary('total_flow_reset_switch', ea.STATE_SET, 'ON', 'OFF').withDescription('Total flow reset switch'), e.numeric('quantitative_watering', ea.STATE_SET).withUnit('L').withValueMin(0).withValueMax(10000) .withDescription('Quantitative watering'), e.binary('flow_switch', ea.STATE_SET, 'ON', 'OFF').withDescription('Flow switch'), e.binary('child_lock', ea.STATE_SET, 'ON', 'OFF').withDescription('Child lock'), e.numeric('surplus_flow', ea.STATE).withDescription('Surplus flow'), e.numeric('single_watering_duration', ea.STATE).withDescription('Single watering duration'), e.numeric('single_watering_amount', ea.STATE).withDescription('Single watering amount'), ], meta: { tuyaDatapoints: [ [1, 'state', tuya.valueConverter.onOff], [3, 'status', tuya.valueConverter.onOff], [5, 'countdown', tuya.valueConverter.raw], [6, 'countdown_left', tuya.valueConverter.raw], [9, 'water_current', tuya.valueConverter.raw], [11, 'battery_percentage', tuya.valueConverter.batteryState], [15, 'water_total', tuya.valueConverter.raw], [19, 'fault', tuya.valueConverter.raw], [37, 'weather_delay', tuya.valueConverter.raw], [38, 'normal_timer', tuya.valueConverter.raw], [42, 'switch_enabled', tuya.valueConverter.onOff], [47, 'smart_irrigation', tuya.valueConverter.raw], [101, 'total_flow_reset_switch', tuya.valueConverter.onOff], [102, 'quantitative_watering', tuya.valueConverter.raw], [103, 'flow_switch', tuya.valueConverter.onOff], [104, 'child_lock', tuya.valueConverter.onOff], [105, 'surplus_flow', tuya.valueConverter.raw], [106, 'single_watering_duration', tuya.valueConverter.raw], [108, 'single_watering_amount', tuya.valueConverter.raw], ], }, };
module.exports = definition;
ohhh .... it seems it may already exist? https://github.com/Koenkk/zigbee-herdsman-converters/blob/da65b1aeffd96527df02725b49de61e453fee059/src/devices/neo.ts#L130 just needs some tweaking?
Hi Guys,
I have created that converter based on this fingerprint _TZE204_rzrrjkz2 in this pull request
And actually not sure if I did it right, because I still don't have a chance to test with my own device (Guess it because the fingerprint is now _TZE204_uab532m0 and not the same as mine _TZE204_rzrrjkz2?)
Anyone have any idea how to solve this? and why do we have different fingerprints on the same device?
edit: Somehow, mine was slightly different with no Neo logo on it, is there any chances that it not actually Neo's ?
FYI this is the info from my vendor: he seems to be sure that this one is Neo's with model number NAS-WV03B
And actually not sure if I did it right, because I still don't have a chance to test with my own device (Guess it because the fingerprint is now _TZE204_uab532m0 and not the same as mine _TZE204_rzrrjkz2?)
you should be able to add your fingerprint as well just change this line to something like
fingerprint: tuya.fingerprint('TS0601', ['_TZE204_uab532m0', ' _TZE204_rzrrjkz2']),
having multiple fingerprints is quite common for TuYa devices. Probably different vendors are just using whitelabled TuYa device. See example a few lines above
if your device did not get recognized in Z2M it was probably due to the lack of the fingerprint, as TuYa makes a mess in the identifications by reusing them incorrectly.
@xpavli44 Thanks man,
And about further investigation for these errors do you have any idea where to start?
@OgV1 unfortunately no clue :(
best I can see is
Now set the Zigbee2MQTT log_level to debug and enable the external definition by adding the following to your Zigbee2MQTT configuration.yaml.
maybe it will provide a little more insight into the errors?
I got one of these off AliExpress, currently the stuff in neo.ts
isn't working particularly well, but I've got a few things working:
But nothing else is working properly. Some things I've noticed when debugging:
onOff
- so far I've observed 4 different values. For now I have this: [3, 'status', tuya.valueConverterBasic.lookup({'off': 0, 'one': 1, 'two': 2, 'three': 3, 'four': 4})]
. I've noticed that when it's off, the value is 0, when you turn it on remotely, the value is 3, and when you turn it on using the device on the button, the value is 4.Looking at the logs, there is also definitely something wrong with commandMcuSyncTime
. Even with the recommended onEvent: tuya.onEventSetTime
, this comes up:
[2024-06-24 17:56:35] debug: z2m: Received Zigbee message from 'zigbee-garden-water-valve', type 'commandMcuSyncTime', cluster 'manuSpecificTuya', data '{"payloadSize":116}' from endpoint 1 with groupID 0
[2024-06-24 17:56:35] debug: zh:controller:endpoint: ZCL command 0xa4c1386d144eb8bf/1 manuSpecificTuya.mcuSyncTime({"payloadSize":8,"payload":[102,121,165,67,102,121,179,83]}, {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":false,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"transactionSequenceNumber":null,"writeUndiv":false})
[2024-06-24 17:56:35] debug: z2m: No converter available for 'NAS-WV03B' with cluster 'manuSpecificTuya' and type 'commandMcuSyncTime' and data '{"payloadSize":116}'
Looking at the code in github, it looks like this might silently fail? https://github.com/Koenkk/zigbee-herdsman-converters/blob/0da0cbb88593b71f94385caeed4714d3dd0d1eb2/src/lib/tuya.ts#L192-L194
Any ideas @xpavli44 ?
Hi @oliverwoodings
This might be a very dumb question, I can see the latest release here, but I'm not sure how I can get it to work with my device on my system? Seems like you guys can access it and test it already, I tried to research for this but cannot find anything, could you please suggest me how to get this work?
@OgV1 by default, the version of herdsman used by z2m only updates when z2m gets a new release. I believe you can switch z2m you can either switch zg2mqtt to use the 'dev' branch, which will make it keep herdsman up to date to the latest release: https://www.zigbee2mqtt.io/advanced/more/switch-to-dev-branch.html
Personally, I've been testing using a custom external definition (using these instructions, using an adapted version of the code from neo.ts
in herdsman.
Thanks @oliverwoodings, here's what I found according to your provided information,
- The water flow is definitely not litres per minute - it's currently saying mine is pumping out 1483 l/min, someone call the firebrigade 😆 Perhaps it's litres per hour, but that still seems high...
- The 'total water flow' (data point 15) is mad - at one point it was reporting massive negative numbers, and is now sitting at 15055228
The water flow unit is normally Gallon, the unit conversion to liters might be messed up.
The current exposes and DP is below
exposes: [
e.numeric('water_current', ea.STATE).withUnit('L/min').withValueMin(0).withValueMax(3785.41).withValueStep(0.001)
.withDescription('Current water flow (L/min)'),
],
meta: {
tuyaDatapoints: [
[9, 'water_current', tuya.valueConverter.raw],
],
},
- The 'status' (data point 3) is definitely not just a simple
onOff
- so far I've observed 4 different values. For now I have this:[3, 'status', tuya.valueConverterBasic.lookup({'off': 0, 'one': 1, 'two': 2, 'three': 3, 'four': 4})]
. I've noticed that when it's off, the value is 0, when you turn it on remotely, the value is 3, and when you turn it on using the device on the button, the value is 4.
The sate should be these: 0 = Off 1 = Currently unknown 2 = Child lock activated 3 = Remotely On 4 = Physical button On
And yes the Child lock button is working
- The battery status never reports - it's always null I tried to change the battery data point to something else, like
The current exposes and DP is below
exposes: [
e.battery(),
],
meta: {
tuyaDatapoints: [
[11, 'battery', tuya.valueConverter.raw],
],
},
And I found another weird behavior. Looks like after we press the button, (doesn't matter remotely or physical) the device will switch off by itself after around 30 seconds, the reason is might because that there is no water through the valve, I have to test. Edit: Alright, I have tested, doesn't stop by itself, there is nothing to worry about this.
Okay, looks like I can get the Battery, Status and Current water flow (L/min) to work
but somehow these ones keep showing 0
I can see from your image above that you somehow can make the "single_watering_amout" and "total water flow" to show the value, would you mind sharing how? @oliverwoodings
did I missed some DPs?
Could you share your latest code? Really intrigued how you got the battery % to work, and what you did for converting to L/min.
The single watering amount and water total just randomly started working after a while, after I put a load of water through the device across a few occasions. Here's my dp's/exposes for those:
e.numeric('water_total', ea.STATE).withUnit('L').withValueMin(0).withValueMax(378541.0).withValueStep(0.001)
.withDescription('Total water flow (L)'),
e.numeric('single_watering_amount', ea.STATE).withDescription('Single watering amount')
...
[15, 'water_total', tuya.valueConverter.raw],
[108, 'single_watering_amount', tuya.valueConverter.raw]
...
By no means complete of course.
Hi @oliverwoodings, sorry for late reply,
Sure, here's the battery and Current water flow L/min.
const GALLON_TO_LITER = 3.78541;
const definition = {
...
exposes: [
...
e.numeric('water_current', ea.STATE).withUnit('L/min').withValueMin(0).withValueMax(3785.41).withValueStep(0.1)
.withDescription('Current water flow (L/min)'),
e.battery(),
...
],
meta: {
tuyaDatapoints: [
...
[9, 'water_current', {
from: (v) => (v * GALLON_TO_LITER / 1000).toFixed(1),
to: (v) => Math.round((parseFloat(v) / GALLON_TO_LITER) * 1000)
}],
[11, 'battery', tuya.valueConverter.raw],
...
],
},
...
Not sure if this gonna work on GH
@OgV1 by default, the version of herdsman used by z2m only updates when z2m gets a new release. I believe you can switch z2m you can either switch zg2mqtt to use the 'dev' branch, which will make it keep herdsman up to date to the latest release: https://www.zigbee2mqtt.io/advanced/more/switch-to-dev-branch.html
Personally, I've been testing using a custom external definition (using these instructions, using an adapted version of the code from
neo.ts
in herdsman.
Hello guys,
Do you think this device will be available on the next release?
@OgV1 by default, the version of herdsman used by z2m only updates when z2m gets a new release. I believe you can switch z2m you can either switch zg2mqtt to use the 'dev' branch, which will make it keep herdsman up to date to the latest release: https://www.zigbee2mqtt.io/advanced/more/switch-to-dev-branch.html Personally, I've been testing using a custom external definition (using these instructions, using an adapted version of the code from
neo.ts
in herdsman.Hello guys,
Do you think this device will be available on the next release?
Hi @eerison,
Unfortunately I don't think we will, as I found the difficulties in findings the working exposes that can work with all of correct data-points, I will be happy if I could get some help from someone who are more expert than me.
@OgV1 by default, the version of herdsman used by z2m only updates when z2m gets a new release. I believe you can switch z2m you can either switch zg2mqtt to use the 'dev' branch, which will make it keep herdsman up to date to the latest release: https://www.zigbee2mqtt.io/advanced/more/switch-to-dev-branch.html Personally, I've been testing using a custom external definition (using these instructions, using an adapted version of the code from
neo.ts
in herdsman.Hello guys, Do you think this device will be available on the next release?
Hi @eerison,
Unfortunately I don't think we will, as I found the difficulties in findings the working exposes that can work with all of correct data-points, I will be happy if I could get some help from someone who are more expert than me.
Well I don't have any idea hehehe, But I just ordered this device and when it arrives I will try to help 🤞🏼
Thank you for reply <3
hey guys
maybe you could open a PR with the current code state, then it could help others to test or help somehow.
@eerison that's been done ... you can use https://github.com/Koenkk/zigbee-herdsman-converters/pull/7630/files to create external converter as per https://www.zigbee2mqtt.io/advanced/support-new-devices/01_support_new_devices.html#_2-2-adding-converter-s-for-your-device
@eerison that's been done ... you can use https://github.com/Koenkk/zigbee-herdsman-converters/pull/7630/files to create external converter as per https://www.zigbee2mqtt.io/advanced/support-new-devices/01_support_new_devices.html#_2-2-adding-converter-s-for-your-device
ahhh I just found it: https://www.zigbee2mqtt.io/devices/NAS-WV03B.html
the image looks a bit different of the original post 😄
well if the integration is done, I guess this issue could be closed, couldn't it?
@eerison I would not close it yet.
@eerison I would not close it yet.
- It is still quirky, it works but it is throwing errors on button press etc. (read in above posts)
- It also does not load the image in z2m so it needs some love as well
thank you for clarify.
I just don't understand why my Water total and Single watering amount keeps showing 0 since the Water current is working, any ideas guys?
Hello Guys.
my Sprinkler finally arrived :),
I am doing some tests and what works is just turn on and off using
{"state": "ON"}
but no water flow then I tried to activate this flow_switch
using
{"flow_switch": "ON"}
But I am getting this error
z2m: No converter available for 'flow_switch' ("ON")
I don't know if you faced the same issue ...
I didn't check yet how to debug it, I guess I can get this info here: https://www.zigbee2mqtt.io/advanced/support-new-devices/01_support_new_devices.html#_2-2-adding-converter-s-for-your-device (as @xpavli44 mentioned), But in case you have some tips how I could debug it "easily", I would appreciate any help :)
@OgV1 by default, the version of herdsman used by z2m only updates when z2m gets a new release. I believe you can switch z2m you can either switch zg2mqtt to use the 'dev' branch, which will make it keep herdsman up to date to the latest release: https://www.zigbee2mqtt.io/advanced/more/switch-to-dev-branch.html
Personally, I've been testing using a custom external definition (using these instructions, using an adapted version of the code from
neo.ts
in herdsman.
Hey @oliverwoodings
could you give me some idea how to tests using neo.ts
when I click on generate_external_definition
just appear this piece of code
But I can't click on read/write button, am I missing something?
@OgV1 by default, the version of herdsman used by z2m only updates when z2m gets a new release. I believe you can switch z2m you can either switch zg2mqtt to use the 'dev' branch, which will make it keep herdsman up to date to the latest release: https://www.zigbee2mqtt.io/advanced/more/switch-to-dev-branch.html Personally, I've been testing using a custom external definition (using these instructions, using an adapted version of the code from
neo.ts
in herdsman.Hey @oliverwoodings
could you give me some idea how to tests using neo.ts
when I click on
generate_external_definition
just appear this piece of codeBut I can't click on read/write button, am I missing something?
@eerison My man, you definitely need to enable the debug for this
mine was first place the code in neo.ts and named to something like
then set your configuration.yaml as this instruction
mine was like this
after restart zb2mqtt the device will be ready to add (you may need to check if your device's fingerprint is matching these?
fingerprint: tuya.fingerprint('TS0601', ['_TZE204_rzrrjkz2', '_TZE204_uab532m0']),
Thank you @OgV1 <3, I will give a try today
hey @OgV1
Could you post your spk.js code here please, it will be easier to test
hey @OgV1
Could you post your spk.js code here please, it will be easier to test
Yeah man feel free to try
edit: I'm not sure if the code will work, please try attached. spk.zip
just to be easy to copy and past in case someone else wants to test your code :)
const {} = require('zigbee-herdsman-converters/lib/modernExtend');
const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
const modernExtend = require('zigbee-herdsman-converters/lib/modernExtend');
const e = exposes.presets;
const ea = exposes.access;
const tuya = require('zigbee-herdsman-converters/lib/tuya');
const GALLON_TO_LITER = 3.78541;
const definition = {
fingerprint: tuya.fingerprint('TS0601', ['_TZE204_rzrrjkz2', '_TZE204_uab532m0']),
zigbeeModel: ['NAS-WV03B'],
model: 'NAS-WV03B',
vendor: 'Neo',
fromZigbee: [tuya.fz.datapoints],
toZigbee: [tuya.tz.datapoints],
description: 'Smart sprinkler timer',
onEvent: tuya.onEventSetTime,
configure: tuya.configureMagicPacket,
exposes: [
e.binary('state', ea.STATE_SET, 'ON', 'OFF').withDescription('Turn the valve On or Off'),
e.enum('status', ea.STATE, ['0', '1', '2', '3']).withDescription('Status'),
e.numeric('countdown', ea.STATE_SET).withUnit('min').withValueMin(1).withValueMax(240).withDescription('Countdown'),
e.numeric('countdown_left', ea.STATE).withUnit('min').withValueMin(1).withValueMax(240).withDescription('Countdown left'),
e.numeric('water_current', ea.STATE).withUnit('L/min').withValueMin(0).withValueMax(3785.41).withValueStep(0.1)
.withDescription('Current water flow (L/min)'), // Changed to liters
e.battery(),
e.numeric('water_total', ea.STATE).withUnit('L').withValueMin(0).withValueMax(378541.0).withValueStep(0.001)
.withDescription('Total water flow (L)'), // Changed to liters
e.binary('fault', ea.STATE, 'DETECTED', 'NOT_DETECTED').withDescription('Fault status'),
e.enum('weather_delay', ea.STATE_SET, ['24h', '48h', '72h', 'cancel']).withDescription('Weather delay'),
e.text('normal_timer', ea.STATE_SET).withDescription('Normal timer'),
e.binary('switch_enabled', ea.STATE_SET, 'ON', 'OFF').withDescription('Switch enabled'),
e.numeric('smart_irrigation', ea.STATE).withDescription('Smart irrigation'),
e.binary('total_flow_reset_switch', ea.STATE_SET, 'ON', 'OFF').withDescription('Total flow reset switch'),
e.numeric('quantitative_watering', ea.STATE_SET).withUnit('L').withValueMin(0).withValueMax(10000)
.withDescription('Quantitative watering'), // Changed to liters
e.binary('flow_switch', ea.STATE_SET, 'ON', 'OFF').withDescription('Flow switch'),
e.binary('child_lock', ea.STATE_SET, 'ON', 'OFF').withDescription('Child lock'),
e.numeric('surplus_flow', ea.STATE).withDescription('Surplus flow'),
e.numeric('single_watering_duration', ea.STATE).withDescription('Single watering duration'),
e.numeric('single_watering_amount', ea.STATE).withDescription('Single watering amount'),
],
meta: {
tuyaDatapoints: [
[1, 'state', tuya.valueConverter.onOff],
[3, 'status', tuya.valueConverterBasic.lookup({'Off': 0, 'one': 1, 'Child lock activated': 2, 'On': 3, 'On_btn': 4})],
[5, 'countdown', tuya.valueConverter.raw],
[6, 'countdown_left', tuya.valueConverter.raw],
[9, 'water_current', {
from: (v) => {
convertedValue = (v * GALLON_TO_LITER / 1000).toFixed(1); // Converts the raw value from gal/min to L/min with one decimal place
console.log(`Raw value for water_current: ${v}, Converted value: ${convertedValue}`);
return convertedValue;
},
to: (v) => {
const rawValue = Math.round((parseFloat(v) / GALLON_TO_LITER) * 1000); // Converts L/min back to the raw value in gal/min
console.log(`Raw value for water_current: ${v}, Raw value: ${rawValue}`);
return rawValue;
},
}],
[11, 'battery', tuya.valueConverter.raw],
[15, 'water_total', {
from: (v) => (v * GALLON_TO_LITER / 1000).toFixed(1), // Converts the raw value from gallons to liters with one decimal place
to: (v) => Math.round((parseFloat(v) / GALLON_TO_LITER) * 1000) // Converts liters back to the raw value in gallons
}],
[19, 'fault', tuya.valueConverter.raw],
[37, 'weather_delay', tuya.valueConverter.raw],
[38, 'normal_timer', tuya.valueConverter.raw],
[42, 'switch_enabled', tuya.valueConverter.onOff],
[47, 'smart_irrigation', tuya.valueConverter.raw],
[101, 'total_flow_reset_switch', tuya.valueConverter.onOff],
[102, 'quantitative_watering', {
from: (v) => (v * GALLON_TO_LITER / 1000).toFixed(1), // Converts the raw value from gallons to liters with one decimal place
to: (v) => Math.round((parseFloat(v) / GALLON_TO_LITER) * 1000) // Converts liters back to the raw value in gallons
}],
[103, 'flow_switch', tuya.valueConverter.onOff],
[104, 'child_lock', tuya.valueConverter.onOff],
[105, 'surplus_flow', tuya.valueConverter.raw],
[106, 'single_watering_duration', tuya.valueConverter.raw],
[108, 'single_watering_amount', {
from: (v) => {
const convertedValue = (v * GALLON_TO_LITER / 1000).toFixed(1);
console.log(`Raw value for single_watering_amount: ${v}, Converted value: ${convertedValue}`);
return convertedValue;
},
to: (v) => {
const rawValue = Math.round((parseFloat(v) / GALLON_TO_LITER) * 1000);
console.log(`Value to be sent for single_watering_amount: ${v}, Raw value: ${rawValue}`);
return rawValue;
}
}],
],
},
};
module.exports = definition;
Hey @OgV1
what did you enabled to see the console.log
? I have log_level: debug
, But I don't see any console log :(
@eerison you need to go Settings -> System -> Logs -> pick Z2M addon in upper right corner
The problem isn't visualize the log, the problem is, the console.log
that I added into the definition, it isn't appearing
I added console.log here
[103, 'flow_switch', {
from: (v) => {
console.log(`debug: [from] flow switch original value ${v}`)
return v;
},
to: (v) => {
console.log(`debug: [to] flow switch original value ${v}`)
return v;
}
}],
but when I change the status, it isn't appearing :/
well I could get some progress at lest 😄
I tested console.debug on state and status field, and both I could see a log, But not with flow_switch
, I belive it is happening because this error is happening before go into the from and to
scope
[2024-07-30 10:57:12] debug: z2m:mqtt: Received MQTT message on 'zigbee2mqtt/sprinkler_01/set' with data '{"flow_switch":"ON"}'
[2024-07-30 10:57:12] error: z2m: No converter available for 'flow_switch' ("ON")
what this no converter available means? because there is a converter to on/off
:/
@OgV1 how do you know those fields are correct?
{
"battery": 67,
"child_lock": "OFF",
"countdown": 4,
"countdown_left": 0,
"linkquality": 116,
"quantitative_watering": "0.0",
"single_watering_amount": "0.0",
"single_watering_duration": 0,
"state": "OFF",
"status": "Off",
"water_current": "0.0",
"water_total": "0.0",
"fault": null,
"flow_switch": null,
"normal_timer": null,
"smart_irrigation": null,
"surplus_flow": null,
"switch_enabled": null,
"total_flow_reset_switch": null,
"weather_delay": null
}
did you use Tuya Iot Platform? https://www.zigbee2mqtt.io/advanced/support-new-devices/03_find_tuya_data_points.html
I have the same valve and have found the tuya end point : {"1":"Switch", boolean "3":"Status", "type": "Enum", "values": "{"range":["off","auto","disabled"]}" "5":"Countdown", "type": "Integer", "values": "{"unit":"min","min":1,"max":240,"scale":0,"step":1}" "6":"Countdown Left", "type": "Integer", "values": "{"unit":"min","min":1,"max":240,"scale":0,"step":1}" "9":"Water Current" "type": "Integer", "values": "{"unit":"gal/min","min":0,"max":1000000000,"scale":3,"step":1}" "11":"Battery Percentage" "type": "Integer", "values": "{"unit":"%","min":0,"max":100,"scale":0,"step":1}" "15":"Water Total" "type": "Integer", "values": "{"unit":"gal","min":0,"max":999999999,"scale":3,"step":1}" "19":"Fault" "37":"Weather Delay", type enum {"range":["24h","48h","72h","cancel"]}" "38":"Normal Timer", "type": "String", "values": "{"maxlen":255}" "42":"Switch", boolean "47":"Smart Irrigation" "101":"Total flow reset switch", "102":"Quantitative watering", "103":"Flow switch"} "104":"Child lock" "105":"Surplus flow" "106":"Single watering time" "107":"Interface refresh", "108":"Amount of watering per time"}
I don't know to write the converter and need help
@dominique6017 are you sure that Flow switch
doesn't have any type?
because on your schema Child lock
doesn't have any type, but it is a boolean (well it works as a boolean hehe)
ohhh .... it seems it may already exist? https://github.com/Koenkk/zigbee-herdsman-converters/blob/da65b1aeffd96527df02725b49de61e453fee059/src/devices/neo.ts#L130 just needs some tweaking?
Hi Guys,
I have created that converter based on this fingerprint _TZE204_rzrrjkz2 in this pull request
And actually not sure if I did it right, because I still don't have a chance to test with my own device (Guess it because the fingerprint is now _TZE204_uab532m0 and not the same as mine _TZE204_rzrrjkz2?)
Anyone have any idea how to solve this? and why do we have different fingerprints on the same device?
edit: Somehow, mine was slightly different with no Neo logo on it, is there any chances that it not actually Neo's ?
FYI this is the info from my vendor: he seems to be sure that this one is Neo's with model number NAS-WV03B
_TZE204_uab532m0 its unit is Imperial gallons. _TZE204_rzrrjkz2 its unit is US gallons. Their model is 'NAS-WV05B2'.
ohhh .... it seems it may already exist? https://github.com/Koenkk/zigbee-herdsman-converters/blob/da65b1aeffd96527df02725b49de61e453fee059/src/devices/neo.ts#L130 just needs some tweaking?
Hi Guys, I have created that converter based on this fingerprint _TZE204_rzrrjkz2 in this pull request And actually not sure if I did it right, because I still don't have a chance to test with my own device (Guess it because the fingerprint is now _TZE204_uab532m0 and not the same as mine _TZE204_rzrrjkz2?) Anyone have any idea how to solve this? and why do we have different fingerprints on the same device? edit: Somehow, mine was slightly different with no Neo logo on it, is there any chances that it not actually Neo's ? FYI this is the info from my vendor: he seems to be sure that this one is Neo's with model number NAS-WV03B
_TZE204_uab532m0 its unit is Imperial gallons. _TZE204_rzrrjkz2 its unit is US gallons. Their model is 'NAS-WV05B2'.
Yep I also saw the model was wrong :/
I am looking forward to see your PR merged 🤞🏼
@OgV1 how do you know those fields are correct?
{ "battery": 67, "child_lock": "OFF", "countdown": 4, "countdown_left": 0, "linkquality": 116, "quantitative_watering": "0.0", "single_watering_amount": "0.0", "single_watering_duration": 0, "state": "OFF", "status": "Off", "water_current": "0.0", "water_total": "0.0", "fault": null, "flow_switch": null, "normal_timer": null, "smart_irrigation": null, "surplus_flow": null, "switch_enabled": null, "total_flow_reset_switch": null, "weather_delay": null }
did you use Tuya Iot Platform? https://www.zigbee2mqtt.io/advanced/support-new-devices/03_find_tuya_data_points.html
Hi @eerison
Yes, I use the same method in that link (The Automatic method on step 8.)
The PR from @baggiowu was closed :(
Could you send here the debug page, then I could see the fields and types.
like this one:
also the request please :) https://www.zigbee2mqtt.io/advanced/support-new-devices/03_find_tuya_data_points.html#_8-find-your-data-point
Note: this screenshot is from a wifi device that I have, as I don't have an getaway tuya I can't test the sprinkler :(
Edit: maybe it was fixed on this PR: https://github.com/Koenkk/zigbee-herdsman-converters/pull/7812 Edit 2: It was released on https://github.com/Koenkk/zigbee-herdsman-converters/releases/tag/v19.72.0
Try this
Standard Status Set
Code Type Values
switch Boolean
"{true,false}"
status Enum
{
"range": [
"off",
"auto",
"disabled"
]
}
countdown Integer
{
"unit": "min",
"min": 1,
"max": 240,
"scale": 0,
"step": 1
}
countdown_left Integer
{
"unit": "min",
"min": 1,
"max": 240,
"scale": 0,
"step": 1
}
water_current Integer
{
"unit": "gal/min",
"min": 0,
"max": 1000000000,
"scale": 3,
"step": 1
}
battery_percentage Integer
{
"unit": "%",
"min": 0,
"max": 100,
"scale": 0,
"step": 1
}
water_total Integer
{
"unit": "gal",
"min": 0,
"max": 999999999,
"scale": 3,
"step": 1
}
weather_delay Enum
{
"range": [
"24h",
"48h",
"72h",
"cancel"
]
}
normal_timer String
{
"maxlen": 255
}
weather_switch Boolean
"{true,false}"
switch_enabled Boolean
"{true,false}"
After I tried with @baggiowu version released, there looks like I still get some errors
I have been playing with this code for the last few days - I can't get the battery to show at all. I have a Tuya account and went in and looked at the code - it says it's 11 and when connected to the Tuya cloud it reports as 100%. I have gone back and forth with the e.battery() vs e.numeric(..) and the raw vs batterypercentage to no affect.
Is there a way in debug to see the report from the device? or does the topic have to be created with the correct data points for it to be published?
My product name in Tuya is Zigbee 05浇灌开关 E版本 美制单位gal
Which translates to Zigbee 05 watering switch E version American unit gal
Here is my code just in case I've made a stupid mistake: `const fz = require('zigbee-herdsman-converters/converters/fromZigbee'); const tz = require('zigbee-herdsman-converters/converters/toZigbee'); const exposes = require('zigbee-herdsman-converters/lib/exposes'); const reporting = require('zigbee-herdsman-converters/lib/reporting'); const modernExtend = require('zigbee-herdsman-converters/lib/modernExtend'); const e = exposes.presets; const ea = exposes.access; const tuya = require('zigbee-herdsman-converters/lib/tuya');
const definition = { fingerprint: tuya.fingerprint('TS0601', ['_TZE204_rzrrjkz2', '_TZE204_uab532m0']), zigbeeModel: ['NAS-WV03B'], model: 'NAS-WV03B', vendor: 'Neo', fromZigbee: [tuya.fz.datapoints], toZigbee: [tuya.tz.datapoints], description: 'Smart sprinkler timerzz', onEvent: tuya.onEventSetTime, configure: tuya.configureMagicPacket, exposes: [ e.switch(), e.enum('status', ea.STATE, ['off', 'auto', 'disabled', 'app_manual', 'key_control']).withDescription('Status'), e.numeric('countdown', ea.STATE_SET).withUnit('min').withValueMin(1).withValueMax(240).withDescription('Countdown'), e.numeric('countdown_left', ea.STATE).withUnit('min').withValueMin(1).withValueMax(240).withDescription('Countdown left'), e .numeric('water_current', ea.STATE) .withUnit('gal/min') .withValueMin(0) .withValueMax(3785.41) .withValueStep(0.001) .withDescription('Current water flow (L/min)'), e.numeric('battery_percentage', ea.STATE).withUnit('%').withValueMin(0).withValueMax(100).withDescription('Battery percentage'), e .numeric('water_total', ea.STATE) .withUnit('G') .withValueMin(0) .withValueMax(378541.0) .withValueStep(0.001) .withDescription('Total water flow (G)'), e.binary('fault', ea.STATE, 'DETECTED', 'NOT_DETECTED').withDescription('Fault status'), e.enum('weather_delay', ea.STATE_SET, ['24h', '48h', '72h', 'cancel']).withDescription('Weather delay'), e.text('normal_timer', ea.STATE_SET).withDescription('Normal timer'), e.binary('switch_enabled', ea.STATE_SET, 'ON', 'OFF').withDescription('Switch enabled'), e.numeric('smart_irrigation', ea.STATE).withDescription('Smart irrigation'), e.binary('total_flow_reset_switch', ea.STATE_SET, 'ON', 'OFF').withDescription('Total flow reset switch'), e .numeric('quantitative_watering', ea.STATE_SET) .withUnit('G') .withValueMin(0) .withValueMax(10000) .withDescription('Quantitative watering'), e.binary('flow_switch', ea.STATE_SET, 'ON', 'OFF').withDescription('Flow switch'), e.binary('child_lock', ea.STATE_SET, 'ON', 'OFF').withDescription('Child lock'), e.numeric('surplus_flow', ea.STATE).withDescription('Surplus flow'), e.numeric('single_watering_duration', ea.STATE).withDescription('Single watering duration'), e.numeric('single_watering_amount', ea.STATE).withDescription('Single watering amount'), ], meta: { tuyaDatapoints: [ [1, 'state', tuya.valueConverter.onOff], [ 3, 'status', tuya.valueConverterBasic.lookup({ off: tuya.enum(0), auto: tuya.enum(1), disabled: tuya.enum(2), app_manual: tuya.enum(3), key_control: tuya.enum(4), }), ], [109, 'countdown', tuya.valueConverter.raw], [6, 'countdown_left', tuya.valueConverter.raw], [9, 'water_current', tuya.valueConverter.raw], [11, 'battery_percentage', tuya.valueConverter.raw], [15, 'water_total', tuya.valueConverter.raw], [19, 'fault', tuya.valueConverter.raw], [37, 'weather_delay', tuya.valueConverter.raw], [38, 'normal_timer', tuya.valueConverter.raw], [42, 'switch_enabled', tuya.valueConverter.onOff], [47, 'smart_irrigation', tuya.valueConverter.raw], [101, 'total_flow_reset_switch', tuya.valueConverter.onOff], [102, 'quantitative_watering', tuya.valueConverter.raw], [103, 'flow_switch', tuya.valueConverter.onOff], [104, 'child_lock', tuya.valueConverter.onOff], [105, 'surplus_flow', tuya.valueConverter.raw], [106, 'single_watering_duration', tuya.valueConverter.raw], [108, 'single_watering_amount', tuya.valueConverter.raw], ], },
};
module.exports = definition; `
Yeah I also tested @baggiowu implementation, but it didn't work 😕
well nothing worked, even turn on/off :(
Hey @OgV1 I saw that @baggiowu added different models, which model appeared for you?
NAS-WV03B?
ohhh .... it seems it may already exist? https://github.com/Koenkk/zigbee-herdsman-converters/blob/da65b1aeffd96527df02725b49de61e453fee059/src/devices/neo.ts#L130 just needs some tweaking?
Hi Guys, I have created that converter based on this fingerprint _TZE204_rzrrjkz2 in this pull request And actually not sure if I did it right, because I still don't have a chance to test with my own device (Guess it because the fingerprint is now _TZE204_uab532m0 and not the same as mine _TZE204_rzrrjkz2?) Anyone have any idea how to solve this? and why do we have different fingerprints on the same device? edit: Somehow, mine was slightly different with no Neo logo on it, is there any chances that it not actually Neo's ? FYI this is the info from my vendor: he seems to be sure that this one is Neo's with model number NAS-WV03B
_TZE204_uab532m0 its unit is Imperial gallons. _TZE204_rzrrjkz2 its unit is US gallons. Their model is 'NAS-WV05B2'.
I think the problem is , we are still taking the old model, I guess it should be NAS-WV05B2
as mentioned by @baggiowu.
But I don't know why it is still the old one NAS-WV03B
And I found another weird behavior. Looks like after we press the button, (doesn't matter remotely or physical) the device will switch off by itself after around 30 seconds, the reason is might because that there is no water through the valve, I have to test. Edit: Alright, I have tested, doesn't stop by itself, there is nothing to worry about this.
My deivce is turning off after 30 seconds, any idea what is going on?
Link
https://www.ebay.co.uk/itm/355700417511
Database entry
{"id":21,"type":"EndDevice","ieeeAddr":"0xa4c13869455a3642","nwkAddr":26812,"manufId":4417,"manufName":"_TZE204_uab532m0","powerSource":"Battery","modelId":"TS0601","epList":[1],"endpoints":{"1":{"profId":260,"epId":1,"devId":81,"inClusterList":[0,4,5,61184],"outClusterList":[25,10],"clusters":{"genBasic":{"attributes":{"65487":14400,"65503":"b��-fc��-\u0012","65506":56,"65508":0,"stackVersion":0,"dateCode":"","appVersion":74}}},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":74,"stackVersion":0,"hwVersion":1,"dateCode":"","zclVersion":3,"interviewCompleted":true,"meta":{},"lastSeen":1716919405582}
Comments
hi, can you hellp me sport new device.Please.
const definition = { zigbeeModel: ['TS0601'], model: 'TS0601', vendor: '_TZE204_uab532m0', description: 'Automatically generated definition', extend: [], meta: {},
External definition