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

[New device support]: TS0601 _TZE200_lvkk0hdg (EPTTECH Tank Level Monitor Zigbee) #21015

Open
rvdlinden opened this issue Jan 25, 2024 · 91 comments
Labels
new device support New device support request

Comments

@rvdlinden
Copy link

Link

https://www.aliexpress.com/item/1005006395402636.html

Database entry

{"id":66,"type":"EndDevice","ieeeAddr":"0x0ceff6fffe4bdda2","nwkAddr":39698,"manufId":4098,"manufName":"_TZE200_lvkk0hdg","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":{"65503":"�ME-\u0019%NE-\u0019aNE-j�NE-j\u000fPE-j�KE-j�KE-\u0019>LE-i","65506":31,"65508":0,"65534":0,"appVersion":65,"modelId":"TS0601","manufacturerName":"_TZE200_lvkk0hdg","powerSource":3,"zclVersion":3,"stackVersion":0,"hwVersion":1,"dateCode":""}}},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":65,"stackVersion":0,"hwVersion":1,"dateCode":"","zclVersion":3,"interviewCompleted":true,"meta":{"configured":-708457359},"lastSeen":1706198663760,"defaultSendRequestWhen":"immediate"}

Comments

I have followed all the documentation on how to add a new unsupported device, but I got stuck on the configuration file. Only 3 out of the 7 Tuya Data Points are working (the read-only points), but the other 4 data points for configuration of the device are seen in Tuya IOT, but refused to be configured in Zigbee2MQTT

The attached external definition file is an attempt to setup the device, but that all I got and do not know how to continue.

The working Data Points and also the failing Data Points are all described in the definition file for easy reference.

NOTE: There is also an identical device, but then it's a Wifi based device. In the Smart Life app both devices are fully working (all 7 Data Points), but in HA (either via Zigbee2MQTT or LocalTuya) only 3 out of 7 Data Points can be used.
See for the TLC2206 Wifi device https://www.aliexpress.com/item/1005005758585356.html

Both devices have equal Data Points
{"1":"Liquid level status","2":"Liquid level depth","7":"Set Max","8":"Set Mini","19":"Installation height","21":"Sensor to full line","22":"Liquid level ratio"}

External defintion

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 extend = require('zigbee-herdsman-converters/lib/extend');
const e = exposes.presets;
const ea = exposes.access;
const tuya = require('zigbee-herdsman-converters/lib/tuya');

const definition = {
  fingerprint: [
    {
      modelID: 'TS0601',
      manufacturerName: '_TZE200_lvkk0hdg',
    },
  ],
  model: 'TS0601_tlc2206zb',
  vendor: 'TuYa',
  whiteLabel: [
    {
      vendor: 'EPTTECH',
      model: 'TLC2206-ZB',
    },
  ],
  description: 'EPTTECH Tank Level Monitor Zigbee',
  fromZigbee: [tuya.fz.datapoints],
  toZigbee: [tuya.tz.datapoints],
  onEvent: tuya.onEventSetTime,
  configure: tuya.configureMagicPacket,
  exposes: [
    e.numeric('liquid_level_percent', ea.STATE)
      .withUnit('%')
      .withDescription('Liquid level percentage'),
    e.numeric('liquid_depth', ea.STATE)
      .withUnit('m')
      .withDescription('Liquid Depth'),
    e.enum('liquid_state', ea.STATE, ['low', 'normal', 'high'])
      .withDescription('Liquid State'),
    // =============== Found but non functional ===============
    /*
    e.numeric('max_set', ea.STATE_SET)
      .withUnit('%')
      .withDescription('Liquid max percentage')
      .withValueMin(0)
      .withValueMax(100)
      .withValueStep(1),
    e.numeric('mini_set', ea.STATE_SET)
      .withUnit('%')
      .withDescription('Liquid minimal percentage')
      .withValueMin(0)
      .withValueMax(100)
      .withValueStep(1),
    e.numeric('installation_height', ea.STATE_SET)
      .withUnit('mm')
      .withDescription('Height from sensor to tank bottom')
      .withValueMin(100)
      .withValueMax(2500)
      .withValueStep(1),
    e.numeric('liquid_depth_max', ea.STATE_SET)
      .withUnit('mm')
      .withDescription('Height from sensor to liquid level')
      .withValueMin(100)
      .withValueMax(1000)
      .withValueStep(1),
    */
  ],
  meta: {
    tuyaDatapoints: [
      [1, 'liquid_state', tuya.valueConverterBasic.lookup({'low': 1, 'normal': 0, 'high': 2})],
      [2, 'liquid_depth', tuya.valueConverter.divideBy100],
      [22, 'liquid_level_percent', tuya.valueConverter.raw],
      // =============== Found but non functional ===============
      /*
      [7, 'max_set', tuya.valueConverter.raw],
      [8, 'mini_set', tuya.valueConverter.raw],
      [19, 'installation_height', tuya.valueConverter.raw],
      [21, 'liquid_depth_max', tuya.valueConverter.raw],
      */
    ],
  },
};

module.exports = definition;
@NDNELSON
Copy link

It is working now ?

@rvdlinden
Copy link
Author

I only have it working via local tuya and using a tuya zigbee gateway.
Directly adding the device to Home Assistant via a zigbee dongle only shows the
the depth, percentage and state values, but all configurable fields like height, min and max are failing.

@NDNELSON
Copy link

Have you tried setup by the new way tuya in the first February home assistant release ? https://www.home-assistant.io/integrations/tuya/

@rvdlinden
Copy link
Author

Yes, I use that, but the device is still unsupported

Screenshot_20240228_173125_Home Assistant

@blouinp
Copy link

blouinp commented Apr 12, 2024

I have the same problem.... unsupported :(

@blouinp
Copy link

blouinp commented Apr 13, 2024

I only have it working via local tuya and using a tuya zigbee gateway. Directly adding the device to Home Assistant via a zigbee dongle only shows the the depth, percentage and state values, but all configurable fields like height, min and max are failing.

HI how you did it?

@rvdlinden
Copy link
Author

rvdlinden commented Apr 13, 2024

So far I can only use it reliable using a tuya zigbee hub and add the zigbee water tank meter to it as a subdevice.

In Home Assistant using this localtuya fork https://xzetsubou.github.io/hass-localtuya/

With the information in this thread you can configure the various entities in localtuya

@TonioClos
Copy link

TonioClos commented May 7, 2024

Hey! Are you still trying to do it directly with zigbee2mqtt or just stayed with local tuya?

@rvdlinden
Copy link
Author

Still local tuya

@TonioClos
Copy link

Okay I´ll stick with HA without local tuya and try then, thank you!

@gregorobreza
Copy link

Hi, I am also also interested in adding support for this device trough Zigbee2MQTT. Same as you, I am struggling with other 4 datapoints. For all four I am getting an error "No converter available".
I would love to contribute If someone can point me in the right direction how to even debug in such cases.

@TheRealWaldo
Copy link

Like everyone here, I'd like to get this working and added as an officially supported device!

@gregorobreza
Copy link

gregorobreza commented May 25, 2024

I thing I finally figure it out. It took a while for me to better understand how to work with zigbee-herdsman-conversters since it is not really well documented and I am relatively new to Zigbee2MQTT.

I just added custom toZigbee converter at the top of the file and used tuya.sendDataPointValue(). This article on medium really helped me understand converters better. And of course searching trough examples of supported devices to se how its done for similar devices.

So here is my external configuration:

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 utils = require("zigbee-herdsman-converters/lib/utils");

const dp = {
  instalationHeight: 19,
  liquidDepthMax: 21,
  maxSet: 7,
  miniSet: 8,
};

const tzdatapoints = {
  key: [
    "installation_height",
    "liquid_depth_max",
    "max_set",
    "mini_set",
  ],
  convertSet: async (entity, key, value, meta) => {
    switch (key) {
      case "installation_height": {
        await tuya.sendDataPointValue(entity, dp.instalationHeight, value);
        break;
      }
      case "liquid_depth_max": {
        await tuya.sendDataPointValue(entity, dp.liquidDepthMax, value);
        break;
      }
      case "max_set": {
        await tuya.sendDataPointValue(entity, dp.maxSet, value);
        break;
      }
      case "mini_set": {
        await tuya.sendDataPointValue(entity, dp.miniSet, value);
        break;
      }
    }
  },
};

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: "_TZE200_lvkk0hdg",
    },
  ],
  model: "TS0601_tlc2206zb",
  vendor: "TuYa",
  whiteLabel: [
    {
      vendor: "EPTTECH",
      model: "TLC2206-ZB",
    },
  ],
  description: "EPTTECH Tank Level Monitor Zigbee",
  fromZigbee: [tuya.fz.datapoints],
  // toZigbee: [tuya.tz.datapoints],
  toZigbee: [tzdatapoints],
  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
    e
      .numeric("liquid_level_percent", ea.STATE)
      .withUnit("%")
      .withDescription("Liquid level percentage"),
    e
      .numeric("liquid_depth", ea.STATE)
      .withUnit("m")
      .withDescription("Liquid Depth"),
    e
      .enum("liquid_state", ea.STATE, ["low", "normal", "high"])
      .withDescription("Liquid State"),

    e
      .numeric("installation_height", ea.STATE_SET)
      .withUnit("mm")
      .withDescription("Height from sensor to tank bottom")
      .withValueMin(100)
      .withValueMax(3000)
      .withValueStep(1),
    e
      .numeric("mini_set", ea.STATE_SET)
      .withUnit("%")
      .withDescription("Liquid minimal percentage")
      .withValueMin(0)
      .withValueMax(100)
      .withValueStep(1),
    e
      .numeric("max_set", ea.STATE_SET)
      .withUnit("%")
      .withDescription("Liquid max percentage")
      .withValueMin(0)
      .withValueMax(100)
      .withValueStep(1),
    e
      .numeric("liquid_depth_max", ea.STATE_SET)
      .withUnit("mm")
      .withDescription("Height from sensor to liquid level")
      .withValueMin(100)
      .withValueMax(2000)
      .withValueStep(1),
  ],
  meta: {
    // All datapoints go in here
    tuyaDatapoints: [
      [22, "liquid_level_percent", tuya.valueConverter.raw],
      [2, "liquid_depth", tuya.valueConverter.divideBy100],
      [
        1,
        "liquid_state",
        tuya.valueConverterBasic.lookup({ low: 1, normal: 0, high: 2 }),
      ],
      [19, "installation_height", tuya.valueConverter.raw],
      [7, "max_set", tuya.valueConverter.raw],
      [8, "mini_set", tuya.valueConverter.raw],
      [21, "liquid_depth_max", tuya.valueConverter.raw],
    ],
  },
  extend: [
    // A preferred new way of extending functionality.
  ],
};

module.exports = definition;

I would appreciate if someone else could test configuration and give feedback. Then we could maybe move further and suggest it as an officially supported device.

@rvdlinden
Copy link
Author

I have removed my tuya gateway and local tuya in HA and connected the TLC ZB directly to HA again.

So far it works like a charm

@petos
Copy link

petos commented May 25, 2024

@gregorobreza
I tested it. Seems it's working 👍

@TonioClos
Copy link

Working perfectly, thank you so much for the code n_n @gregorobreza

@didi3r
Copy link

didi3r commented Jun 9, 2024

@gregorobreza it's working fine on my end too. Thanks!

@ocigam69
Copy link

Hello,
@gregorobreza Thanks for the code. Very good job!
I have a problem. I’ve created the file and placed it next to the configuration.yaml file of Z2M, but when configuring it in the external converters, I encounter an error: external_converters must be array
I’ve also added the following entry to the configuration.yaml file of Z2M, but it still hasn’t worked:

external_converters:
  - bidon.js

@ocigam69
Copy link

After many tests, I just needed to leave a blank line at the end of the file. 😊
Thanks @gregorobreza !!!

@gregorobreza
Copy link

Hm interesting 🤔. Happy to hear that you solved it!👍

@SentenciaLaMalice
Copy link

Hi!. Somebody knows if this new device is going to be integrated in the native Z2M in a close future?

I have just purchased it and I don't feel very confortable yet touching the guts of Z2M so, if it's comming to Z2M, I will just wait a little.

Thanks in advance!.

@ivanfmartinez
Copy link
Contributor

Received sensor today, and was detected fine by @gregorobreza definition #21015 (comment)

@SentenciaLaMalice
Copy link

I decided to give a try to @gregorobreza code a try (thank you very much sir) and it worked great. The sensor started reporting perfectly. But, sadly, as soon as I configured the levels of my setup using the "Expose" tab on Z2M the device does not report the level anymore. I was not able to fix it, I keep getting zero per cent :(

@SentenciaLaMalice
Copy link

Just to add that I just noticed on the debug logs of Z2M that the device is sending a huge ammount of messages per minute with its current status. Didn't count them but I estimate 100 message per minute easily. I let one log line here for if it helps

2024-06-17 23:00:49MQTT publish: topic 'zigbee2mqtt/nivel_gasoil', payload '{"installation_height":1045,"linkquality":87,"liquid_depth":0,"liquid_depth_max":100,"liquid_level_percent":0,"liquid_state":"low","max_set":95,"mini_set":20}'

@jtscott
Copy link

jtscott commented Jun 17, 2024

Just to add that I just noticed on the debug logs of Z2M that the device is sending a huge ammount of messages per minute with its current status.

I noticed this as well, the Availability reflects this as the device is always 'just now' and doesn't seem to quit. Would be nice to be able to set the report interval if possible.

@gregorobreza
Copy link

I decided to give a try to @gregorobreza code a try (thank you very much sir) and it worked great. The sensor started reporting perfectly. But, sadly, as soon as I configured the levels of my setup using the "Expose" tab on Z2M the device does not report the level anymore. I was not able to fix it, I keep getting zero per cent :(

Thats strange... Are you sure your configured levels make sense and are set correctly based on sensor instructions?

@gregorobreza
Copy link

gregorobreza commented Jun 19, 2024

Just to add that I just noticed on the debug logs of Z2M that the device is sending a huge ammount of messages per minute with its current status.

I noticed this as well, the Availability reflects this as the device is always 'just now' and doesn't seem to quit. Would be nice to be able to set the report interval if possible.

I am not really sure that device support setting reporting interval. Device behaves in the same manner when used with tuya hub and it seem this is expected behaviour. But definitely worth to dig a bit deeper to check if possible.

@DrTrotty
Copy link

Hello. Correspondence...correspondence, I received the new device. I tried it with the tuya app, so far all settings are working perfectly. Zigbee2mqtt is coming next week...

@DrTrotty
Copy link

Hello. All values ​​of the new device work correctly even under HA. :D Finally!

@c4m0-lab
Copy link

very nice :)

did you have also the problem with a flood of messages in HA?

@DrTrotty
Copy link

Yes. It flashed a lot... I still don't know what the solution is...

@DrTrotty
Copy link

What happens if it reports many times?

@DrTrotty
Copy link

DrTrotty commented Sep 24, 2024

I've tried setting the debounce value with little success. with a value between 1 and 10. It has slowed down to the point where the device doesn't even matter anymore. What am I doing wrong? @jesse-kaufman

@DrTrotty
Copy link

I don't know, someone indicated, setting the maximum liquid level doesn't work for me with the tuya application either. No matter how much I change, the value of the percentage does not change

Yup, I ended up just disabling everything except the current depth in meters, setup a template sensor to calculate water level %, and setup my own alerts separate from the min/max settings on the device itself

I also set debounce to 1 and added liquid_depth and linkquality to the debounce_ignore ... the device is much less chatty now .. it sends updates anywhere from 2-20 seconds apart, rather than at least one per second (if not more)

@ivanfmartinez
Copy link
Contributor

What happens if it reports many times?

@DrTrotty I have found this problems in my case

  • z2m web interface are slower because receive and process this multilple unecessary messages
  • homeassistant database became big, sending one message per second will have 60 times more data than if just send one per minute which is enough for my water level and ambient sensors.

@DrTrotty
Copy link

What happens if it reports many times?

@DrTrotty I have found this problems in my case

* z2m web interface are slower because receive and process this multilple unecessary messages

* homeassistant database became big, sending one message per second will have 60 times more data than if just send one per minute which is enough for my water level and ambient sensors.

Can unnecessary data be deleted? For example, every month...

@ivanfmartinez
Copy link
Contributor

On home assistant you can set the period that short term data will be keep, but is a single value for ALL entities. You cannot set period for entity, you can exclude some by using filters.

Long term are keep forever, but is a summary then lower data space need.

@DrTrotty
Copy link

Thanks.

@Suschibomber
Copy link

Hi guys, I also bought this sensor for my oil barrels. Today I added it via Z2MQTT, but I don't see any entities. Can someone help me how to get the sensor to work under HA?

@Suschibomber
Copy link

This is what I see on Z2MQTT:

Über
Details
Bindungen
Berichte
Einstellungen
Einstellungen (spezifisch)
Status
Cluster
Szene
Entwickler-Konsole
Gerätename
Zigbee Füllstandsmesser
Beschreibung
Zuletzt gesehen
N/A
Verfügbarkeit
Deaktiviert
Geräte-Typ
EndDevice
Zigbee-Modell
TS0601
Zigbee-Hersteller
_TZE284_kyyu8rbj
Unterstützungsstatus
Null (how_to_add_support)
IEEE-Addresse
0xa4c1382b589fb5db
Netzwerk-Adresse
0xCFA9 / 53161
Spannungsversorgung
Batterie
Interview erfolgreich
Trifft zu

@Suschibomber
Copy link

@jesse-kaufman
Copy link

This is what I see on Z2MQTT:

Über Details Bindungen Berichte Einstellungen Einstellungen (spezifisch) Status Cluster Szene Entwickler-Konsole Gerätename Zigbee Füllstandsmesser Beschreibung Zuletzt gesehen N/A Verfügbarkeit Deaktiviert Geräte-Typ EndDevice Zigbee-Modell TS0601 Zigbee-Hersteller _TZE284_kyyu8rbj Unterstützungsstatus Null (how_to_add_support) IEEE-Addresse 0xa4c1382b589fb5db Netzwerk-Adresse 0xCFA9 / 53161 Spannungsversorgung Batterie Interview erfolgreich Trifft zu

You'll need to add an external converter to Z2M:

  1. Create a file named "TZE200.js" and put it in the same directory as your Z2M configuration.yml file
  2. Use the text below as the content for TZE200.js
  3. Add TZE200.js on the external converters tab to Z2M's settings
  4. Restart Z2M

TZE200.js contents:

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 utils = require("zigbee-herdsman-converters/lib/utils");

const dp = {
  instalationHeight: 19,
  liquidDepthMax: 21,
  maxSet: 7,
  miniSet: 8,
};

const tzdatapoints = {
  key: [
    "installation_height",
    "liquid_depth_max",
    "max_set",
    "mini_set",
  ],
  convertSet: async (entity, key, value, meta) => {
    switch (key) {
      case "installation_height": {
        await tuya.sendDataPointValue(entity, dp.instalationHeight, value);
        break;
      }
      case "liquid_depth_max": {
        await tuya.sendDataPointValue(entity, dp.liquidDepthMax, value);
        break;
      }
      case "max_set": {
        await tuya.sendDataPointValue(entity, dp.maxSet, value);
        break;
      }
      case "mini_set": {
        await tuya.sendDataPointValue(entity, dp.miniSet, value);
        break;
      }
    }
  },
};

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: "_TZE200_lvkk0hdg",
    },
  ],
  model: "TS0601_tlc2206zb",
  vendor: "TuYa",
  whiteLabel: [
    {
      vendor: "EPTTECH",
      model: "TLC2206-ZB",
    },
  ],
  description: "EPTTECH Tank Level Monitor Zigbee",
  fromZigbee: [tuya.fz.datapoints],
  // toZigbee: [tuya.tz.datapoints],
  toZigbee: [tzdatapoints],
  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
    e
      .numeric("liquid_level_percent", ea.STATE)
      .withUnit("%")
      .withDescription("Liquid level percentage"),
    e
      .numeric("liquid_depth", ea.STATE)
      .withUnit("m")
      .withDescription("Liquid Depth"),
    e
      .enum("liquid_state", ea.STATE, ["low", "normal", "high"])
      .withDescription("Liquid State"),

    e
      .numeric("installation_height", ea.STATE_SET)
      .withUnit("mm")
      .withDescription("Height from sensor to tank bottom")
      .withValueMin(100)
      .withValueMax(3000)
      .withValueStep(1),
    e
      .numeric("mini_set", ea.STATE_SET)
      .withUnit("%")
      .withDescription("Liquid minimal percentage")
      .withValueMin(0)
      .withValueMax(100)
      .withValueStep(1),
    e
      .numeric("max_set", ea.STATE_SET)
      .withUnit("%")
      .withDescription("Liquid max percentage")
      .withValueMin(0)
      .withValueMax(100)
      .withValueStep(1),
    e
      .numeric("liquid_depth_max", ea.STATE_SET)
      .withUnit("mm")
      .withDescription("Height from sensor to liquid level")
      .withValueMin(100)
      .withValueMax(2000)
      .withValueStep(1),
  ],
  meta: {
    // All datapoints go in here
    tuyaDatapoints: [
      [22, "liquid_level_percent", tuya.valueConverter.raw],
      [2, "liquid_depth", tuya.valueConverter.divideBy100],
      [
        1,
        "liquid_state",
        tuya.valueConverterBasic.lookup({ low: 1, normal: 0, high: 2 }),
      ],
      [19, "installation_height", tuya.valueConverter.raw],
      [7, "max_set", tuya.valueConverter.raw],
      [8, "mini_set", tuya.valueConverter.raw],
      [21, "liquid_depth_max", tuya.valueConverter.raw],
    ],
  },
  extend: [
    // A preferred new way of extending functionality.
  ],
};

module.exports = definition;

@Suschibomber
Copy link

Suschibomber commented Sep 28, 2024

@jesse-kaufman Wow, that was quick and then it should recognize all entities and then everything should work? Thank you very much.

And do I have to remove the device and add it again?

@ivanfmartinez
Copy link
Contributor

Zigbee-Hersteller
_TZE284_kyyu8rbj

@Suschibomber if this is the "Zigbee Manufaturer" your sensor is different from the one that we are talking here. The aliexpress link that you send shows a different model ME201WZ

@Suschibomber
Copy link

Zigbee-Hersteller
_TZE284_kyyu8rbj

@Suschibomber if this is the "Zigbee Manufaturer" your sensor is different from the one that we are talking here. The aliexpress link that you send shows a different model ME201WZ

😫 Ok and what do I do now?

@ivanfmartinez
Copy link
Contributor

ivanfmartinez commented Sep 28, 2024

Zigbee-Hersteller
_TZE284_kyyu8rbj

@Suschibomber if this is the "Zigbee Manufaturer" your sensor is different from the one that we are talking here. The aliexpress link that you send shows a different model ME201WZ

😫 Ok and what do I do now?

You can try to put your data in the fingerprint definition in the js file to see if it works.

If not works I suggest to open a new issue to start checking this device.

@Suschibomber
Copy link

Can you tell me by chance how I do it? I'm not so practiced in it.

@joe8008
Copy link

joe8008 commented Oct 4, 2024

@JoeWals
Copy link

JoeWals commented Oct 4, 2024

Hi Community!

I also bought the TLC2606-ZB and trying to make it work. However, I’m using ZHA. Is there any way to make it work or do I need to migrate to Z2M?

Apologies if this is a dumb question, I’m still pretty new to this. :)

Thanks for your support!

@elik745i
Copy link

elik745i commented Oct 5, 2024

same here Im using ZHA too, any idea how to integrate?

@elik745i
Copy link

elik745i commented Oct 7, 2024

for ZHA I came up with custom quirk, but either it is not recognized or there is something wrong with it:
`"""Custom quirk for EPTTECH TLC2206-ZB Tank Level Sensor."""

from zigpy.profiles import zha # Importing zha profile
from zigpy.quirks import CustomDevice
from zigpy.zcl.clusters.general import Basic, Groups, Scenes, Ota, Time
from zhaquirks.const import (
DEVICE_TYPE,
ENDPOINTS,
INPUT_CLUSTERS,
MODELS_INFO,
OUTPUT_CLUSTERS,
PROFILE_ID,
)
from zhaquirks.tuya import TuyaLocalCluster
from zhaquirks.tuya.mcu import DPToAttributeMapping, TuyaMCUCluster
import zigpy.types as t

Define the data points (DPs) for the sensor

TUYA_TANK_LEVEL_PERCENT_DP = 22
TUYA_TANK_DEPTH_DP = 2
TUYA_TANK_STATE_DP = 1
TUYA_INSTALLATION_HEIGHT_DP = 19
TUYA_MAX_SET_DP = 7
TUYA_MIN_SET_DP = 8
TUYA_DEPTH_MAX_DP = 21

class LiquidLevelStatus(t.enum8):
"""Enum for liquid level status."""
NORMAL = 0x00
LOW = 0x01
HIGH = 0x02

class TuyaTankLevelMeasurement(TuyaLocalCluster):
"""Custom cluster for tank level measurement."""

attributes = {
    0xFF00: ("liquid_level_percent", t.uint8_t, True),
    0xFF01: ("liquid_depth", t.uint16_t, True),  # Assuming depth is in mm
    0xFF02: ("liquid_state", LiquidLevelStatus, True),
    0xFF03: ("installation_height", t.uint16_t, True),  # mm
    0xFF04: ("max_set", t.uint8_t, True),  # Percentage
    0xFF05: ("mini_set", t.uint8_t, True),  # Percentage
    0xFF06: ("liquid_depth_max", t.uint16_t, True),  # mm
}

class TuyaTankLevelCluster(TuyaMCUCluster):
"""Custom cluster for handling EPTTECH TLC2206-ZB tank level sensor data points."""

dp_to_attribute = {
    TUYA_TANK_LEVEL_PERCENT_DP: DPToAttributeMapping(
        TuyaTankLevelMeasurement.ep_attribute,
        "liquid_level_percent",
        converter=lambda x: int(x),  # Explicit conversion to int
    ),
    TUYA_TANK_DEPTH_DP: DPToAttributeMapping(
        TuyaTankLevelMeasurement.ep_attribute,
        "liquid_depth",
        converter=lambda x: float(x) / 100,  # Convert mm to meters explicitly as float
    ),
    TUYA_TANK_STATE_DP: DPToAttributeMapping(
        TuyaTankLevelMeasurement.ep_attribute,
        "liquid_state",
        converter=lambda x: LiquidLevelStatus(x),  # Use explicit conversion for enum
    ),
    TUYA_INSTALLATION_HEIGHT_DP: DPToAttributeMapping(
        TuyaTankLevelMeasurement.ep_attribute,
        "installation_height",
        converter=lambda x: int(x),  # Explicit int conversion
    ),
    TUYA_MAX_SET_DP: DPToAttributeMapping(
        TuyaTankLevelMeasurement.ep_attribute,
        "max_set",
        converter=lambda x: int(x),  # Explicit int conversion
    ),
    TUYA_MIN_SET_DP: DPToAttributeMapping(
        TuyaTankLevelMeasurement.ep_attribute,
        "mini_set",
        converter=lambda x: int(x),  # Explicit int conversion
    ),
    TUYA_DEPTH_MAX_DP: DPToAttributeMapping(
        TuyaTankLevelMeasurement.ep_attribute,
        "liquid_depth_max",
        converter=lambda x: int(x),  # Explicit int conversion
    ),
}

data_point_handlers = {
    TUYA_TANK_LEVEL_PERCENT_DP: "_dp_2_attr_update",
    TUYA_TANK_DEPTH_DP: "_dp_2_attr_update",
    TUYA_TANK_STATE_DP: "_dp_2_attr_update",
    TUYA_INSTALLATION_HEIGHT_DP: "_dp_2_attr_update",
    TUYA_MAX_SET_DP: "_dp_2_attr_update",
    TUYA_MIN_SET_DP: "_dp_2_attr_update",
    TUYA_DEPTH_MAX_DP: "_dp_2_attr_update",
}

class EPTTECH_TLC2206ZB(CustomDevice):
"""Custom quirk for EPTTECH TLC2206-ZB Tank Level Sensor."""

signature = {
    MODELS_INFO: [("TS0601", "_TZE200_lvkk0hdg")],
    ENDPOINTS: {
        1: {
            PROFILE_ID: zha.PROFILE_ID,
            DEVICE_TYPE: zha.DeviceType.IAS_ZONE,  # Device type commonly used for sensors
            INPUT_CLUSTERS: [
                Basic.cluster_id,
                TuyaTankLevelCluster.cluster_id,  # Custom cluster for tank level
            ],
            OUTPUT_CLUSTERS: [
                Ota.cluster_id,
                Time.cluster_id,
            ],
        },
    },
}

replacement = {
    ENDPOINTS: {
        1: {
            PROFILE_ID: zha.PROFILE_ID,
            DEVICE_TYPE: zha.DeviceType.IAS_ZONE,
            INPUT_CLUSTERS: [
                Basic.cluster_id,
                TuyaTankLevelCluster,  # Custom cluster for tank level
            ],
            OUTPUT_CLUSTERS: [
                Ota.cluster_id,
                Time.cluster_id,
            ],
        },
    },
}

`

@Gounick
Copy link

Gounick commented Oct 7, 2024

Hi @elik745i , I think you should post this custom quirk in zigpy/zha-device-handlers issues 😉

@jesse-kaufman
Copy link

For those frustrated with the spammy-ness of this device, it looks like there's a new "throttle" feature coming (17ac9cf )!

I just switched my Z2M container over to latest-dev and it works great! I didn't see a place to configure the throttle in the GUI, but when I added it to configuration.yaml, it worked as expected! Throttling it back to 15s makes a huge difference in the responsiveness of the web GUI and I'll probably throttle it back even further—once a minute is probably plenty for my application

@ivanfmartinez
Copy link
Contributor

I just switched my Z2M container over to latest-dev and it works great! I didn't see a place to configure the throttle in the GUI, but when I added it to configuration.yaml, it worked as expected! Throttling it back to 15s makes a huge difference in the responsiveness of the web GUI and I'll probably throttle it back even further—once a minute is probably plenty for my application

Yes, my patch was only on the backend, you must configure on yaml until someone that knows how the frontend works add it to the frontend.

I use 30s and 45s in my devices.

@jesse-kaufman
Copy link

Yes, my patch was only on the backend, you must configure on yaml until someone that knows how the frontend works add it to the frontend.

Cool, cool, no worries! I'm super grateful for the addition! I have this water level sensor and 5 mmWave sensors that are super chatty and throttling them back has made a significant difference in the amount of traffic

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

No branches or pull requests