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

Solar / Floating Water Quality Tester #7215

Closed
sirinveen opened this issue Sep 8, 2023 · 25 comments
Closed

Solar / Floating Water Quality Tester #7215

sirinveen opened this issue Sep 8, 2023 · 25 comments

Comments

@sirinveen
Copy link

Device

  • Product name: Solar / Floating Water Quality Tester
  • Manufacturer: _TZE200_v1jqz5cy
  • Model identifier: TS0601
  • Device type : Sensor

Screenshots

Basic

image

Identify

Alarms

Device Temperature

Groups

image
image

Scenes

image
image
image
image

On/Off

Level Control

Color Control

Simple Metering

Diagnostics

Other clusters that are not mentioned above

image

@sirinveen
Copy link
Author

sirinveen commented Sep 8, 2023

Here the complete DDF I receive value but for chlorine I'm not sure ist correct:

ONLY WORK WITH THE LAST BETA VERSION OF deCONZ 2.23.0-beta

{

  "schema": "devcap1.schema.json",
  "manufacturername": "_TZE200_v1jqz5cy",
  "modelid": "TS0601",
  "vendor": "Tuya",
  "product": "Zigbee Chlorine Meter PH ORP EC TDS Salinity Temp CL",
  "sleeper": false,
  "status": "Gold",
  "path": "/devices/_TZE200_TS0601_v1jqz5cy_v7.json",
  "subdevices": [
    {
      "type": "$TYPE_TEMPERATURE_SENSOR",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0x0514"
      ],
      "items": [
        {
          "name": "attr/id"
        },
        {
          "name": "attr/lastannounced"
        },
        {
          "name": "attr/lastseen"
        },
        {
          "name": "attr/manufacturername"
        },
        {
          "name": "attr/modelid"
        },
        {
          "name": "attr/name"
        },
        {
          "name": "attr/swversion",
          "refresh.interval": 86394,
          "read": {
            "at": "0x0001",
            "cl": "0x0000",
            "ep": 0,
            "fn": "zcl"
          },
          "parse": {
            "at": "0x0001",
            "cl": "0x0000",
            "ep": 255,
            "fn": "zcl",
            "script": "tuya_swversion.js"
          }
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "config/battery",
          "refresh.interval": 3600,
          "read": {
            "fn": "tuya"
          },
          "parse": {
            "dpid": 7,
            "eval": "Item.val = Attr.val;",
            "fn": "tuya"
          },
          "default": 0
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "state/lastupdated"
        },
        {
          "name": "state/temperature",
          "refresh.interval": 3600,
          "read": {
            "fn": "tuya"
          },
          "parse": {
            "dpid": 2,
            "eval": "Item.val = (10 * Attr.val);",
            "fn": "tuya"
          },
          "default": 0
        }
      ]
    },
    {
      "type": "$TYPE_PH_SENSOR",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0x0512"
      ],
      "items": [
        {
          "name": "attr/lastannounced"
        },
        {
          "name": "attr/lastseen"
        },
        {
          "name": "attr/manufacturername"
        },
        {
          "name": "attr/modelid"
        },
        {
          "name": "attr/name"
        },
        {
          "name": "attr/swversion",
          "refresh.interval": 86400,
          "read": {
            "at": "0x0001",
            "cl": "0x0000",
            "ep": 0,
            "fn": "zcl"
          },
          "parse": {
            "at": "0x0001",
            "cl": "0x0000",
            "ep": 255,
            "fn": "zcl",
            "script": "tuya_swversion.js"
          }
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "cap/measured_value/unit",
          "static": "pH"
        },
        {
          "name": "config/battery",
          "refresh.interval": 3600,
          "read": {
            "fn": "tuya"
          },
          "parse": {
            "dpid": 7,
            "eval": "Item.val = Attr.val;",
            "fn": "tuya"
          },
          "default": 0
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "state/lastupdated"
        },
        {
          "name": "state/measured_value",
          "refresh.interval": 3600,
          "read": {
            "fn": "tuya"
          },
          "parse": {
            "dpid": 10,
            "eval": "Item.val = Attr.val;",
            "fn": "tuya"
          },
          "default": 0
        }
      ]
    },
    {
      "type": "$TYPE_CHLORINE_SENSOR",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0x041a"
      ],
      "items": [
        {
          "name": "attr/id"
        },
        {
          "name": "attr/lastannounced"
        },
        {
          "name": "attr/lastseen"
        },
        {
          "name": "attr/manufacturername"
        },
        {
          "name": "attr/modelid"
        },
        {
          "name": "attr/name"
        },
        {
          "name": "attr/swversion",
          "refresh.interval": 86400,
          "read": {
            "at": "0x0001",
            "cl": "0x0000",
            "ep": 0,
            "fn": "zcl"
          },
          "parse": {
            "at": "0x0001",
            "cl": "0x0000",
            "ep": 255,
            "fn": "zcl",
            "script": "tuya_swversion.js"
          }
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "cap/measured_value/max",
          "default": 0
        },
        {
          "name": "cap/measured_value/min",
          "default": 0
        },
        {
          "name": "cap/measured_value/unit",
          "static": "mg/L"
        },
        {
          "name": "config/battery",
          "refresh.interval": 3600,
          "read": {
            "fn": "tuya"
          },
          "parse": {
            "dpid": 7,
            "eval": "Item.val = Attr.val;",
            "fn": "tuya"
          },
          "default": 0
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "state/lastupdated"
        },
        {
          "name": "state/measured_value",
          "refresh.interval": 3600,
          "parse": {
            "dpid": 102,
            "eval": "Item.val = (ZclFrame.at(3) << 32) | (ZclFrame.at(2) << 16) | (ZclFrame.at(1) << 8) | ZclFrame.at(0);",
            "fn": "tuya"
          },
          "default": 0
        }
      ]
    },
    {
      "type": "$TYPE_ORP_SENSOR",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0x042a"
      ],
      "items": [
        {
          "name": "attr/id"
        },
        {
          "name": "attr/lastannounced"
        },
        {
          "name": "attr/lastseen"
        },
        {
          "name": "attr/manufacturername"
        },
        {
          "name": "attr/modelid"
        },
        {
          "name": "attr/name"
        },
        {
          "name": "attr/swversion",
          "refresh.interval": 86400,
          "read": {
            "at": "0x0001",
            "cl": "0x0000",
            "ep": 0,
            "fn": "zcl"
          },
          "parse": {
            "at": "0x0001",
            "cl": "0x0000",
            "ep": 255,
            "fn": "zcl",
            "script": "tuya_swversion.js"
          }
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "cap/measured_value/max",
          "description": "Maximum value of state/measured_value.",
          "default": 0
        },
        {
          "name": "cap/measured_value/min",
          "description": "Minimum value of state/measured_value.",
          "default": 0
        },
        {
          "name": "cap/measured_value/unit",
          "static": "mV"
        },
        {
          "name": "config/battery",
          "refresh.interval": 3600,
          "read": {
            "fn": "tuya"
          },
          "parse": {
            "dpid": 7,
            "eval": "Item.val = Attr.val;",
            "fn": "tuya"
          },
          "default": 0
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "state/lastupdated"
        },
        {
          "name": "state/measured_value",
          "refresh.interval": 3600,
          "parse": {
            "dpid": 101,
            "eval": "Item.val = (ZclFrame.at(3) << 32) | (ZclFrame.at(2) << 16) | (ZclFrame.at(1) << 8) | ZclFrame.at(0);",
            "fn": "tuya"
          },
          "default": 0
        }
      ]
    },
    {
      "type": "$TYPE_EC_SENSOR",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0x043a"
      ],
      "items": [
        {
          "name": "attr/id"
        },
        {
          "name": "attr/lastannounced"
        },
        {
          "name": "attr/lastseen"
        },
        {
          "name": "attr/manufacturername"
        },
        {
          "name": "attr/modelid"
        },
        {
          "name": "attr/name"
        },
        {
          "name": "attr/swversion",
          "refresh.interval": 86400,
          "read": {
            "at": "0x0001",
            "cl": "0x0000",
            "ep": 0,
            "fn": "zcl"
          },
          "parse": {
            "at": "0x0001",
            "cl": "0x0000",
            "ep": 255,
            "fn": "zcl",
            "script": "tuya_swversion.js"
          }
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "cap/measured_value/max",
          "description": "Maximum value of state/measured_value.",
          "default": 0
        },
        {
          "name": "cap/measured_value/min",
          "description": "Minimum value of state/measured_value.",
          "default": 0
        },
        {
          "name": "cap/measured_value/unit",
          "static": "μS/cm"
        },
        {
          "name": "config/battery",
          "refresh.interval": 3600,
          "read": {
            "fn": "tuya"
          },
          "parse": {
            "dpid": 7,
            "eval": "Item.val = Attr.val;",
            "fn": "tuya"
          },
          "default": 0
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "state/lastupdated"
        },
        {
          "name": "state/measured_value",
          "refresh.interval": 3600,
          "parse": {
            "dpid": 11,
            "eval": "Item.val = (ZclFrame.at(3) << 32) | (ZclFrame.at(2) << 16) | (ZclFrame.at(1) << 8) | ZclFrame.at(0);",
            "fn": "tuya"
          },
          "default": 0
        }
      ]
    },
    {
      "type": "$TYPE_TDS_SENSOR",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0x042B"
      ],
      "items": [
        {
          "name": "attr/lastannounced"
        },
        {
          "name": "attr/lastseen"
        },
        {
          "name": "attr/manufacturername"
        },
        {
          "name": "attr/modelid"
        },
        {
          "name": "attr/name"
        },
        {
          "name": "attr/swversion",
          "refresh.interval": 86400,
          "read": {
            "at": "0x0001",
            "cl": "0x0000",
            "ep": 0,
            "fn": "zcl"
          },
          "parse": {
            "at": "0x0001",
            "cl": "0x0000",
            "ep": 255,
            "fn": "zcl",
            "script": "tuya_swversion.js"
          }
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "cap/measured_value/unit",
          "static": "ppm"
        },
        {
          "name": "config/battery",
          "refresh.interval": 3600,
          "read": {
            "fn": "tuya"
          },
          "parse": {
            "dpid": 7,
            "eval": "Item.val = Attr.val;",
            "fn": "tuya"
          },
          "default": 0
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "state/lastupdated"
        },
        {
          "name": "state/measured_value",
          "refresh.interval": 3600,
          "read": {
            "fn": "tuya"
          },
          "parse": {
            "dpid": 1,
            "eval": "Item.val = Attr.val;",
            "fn": "tuya"
          },
          "default": 0
        }
      ]
    },
    {
      "type": "$TYPE_SALT_SENSOR",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0x040D"
      ],
      "items": [
        {
          "name": "attr/lastannounced"
        },
        {
          "name": "attr/lastseen"
        },
        {
          "name": "attr/manufacturername"
        },
        {
          "name": "attr/modelid"
        },
        {
          "name": "attr/name"
        },
        {
          "name": "attr/swversion",
          "refresh.interval": 86400,
          "read": {
            "at": "0x0001",
            "cl": "0x0000",
            "ep": 0,
            "fn": "zcl"
          },
          "parse": {
            "at": "0x0001",
            "cl": "0x0000",
            "ep": 255,
            "fn": "zcl",
            "script": "tuya_swversion.js"
          }
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "cap/measured_value/unit",
          "static": "ppm"
        },
        {
          "name": "config/battery",
          "refresh.interval": 3600,
          "read": {
            "fn": "tuya"
          },
          "parse": {
            "dpid": 7,
            "eval": "Item.val = Attr.val;",
            "fn": "tuya"
          },
          "default": 0
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "state/lastupdated"
        },
        {
          "name": "state/measured_value",
          "refresh.interval": 3600,
          "read": {
            "fn": "tuya"
          },
          "parse": {
            "dpid": 117,
            "eval": "Item.val = Attr.val;",
            "fn": "tuya"
          },
          "default": 0
        }
      ]
    }
  ]
}

@sirinveen
Copy link
Author

sirinveen commented Sep 8, 2023

Hi @manup

Result of Chlorine = 6721026 (raw number) normally CL must be a range of 0.0 - 4.0 mg/L

Expression in DDF: Item.val = (ZclFrame.at(3) << 32) | (ZclFrame.at(2) << 16) | (ZclFrame.at(1) << 8) | ZclFrame.at(0);

And used with a subdivides chlorine_sensor.json not sure if it's used?!?

Tag "cap/measured_value/dimension" don't exist with the last version 2.23.0-beta

{
    "schema": "subdevice1.schema.json",
    "type": "$TYPE_CHLORINE_SENSOR",
    "name": "ZHAChlorine",
    "restapi": "/sensors",
    "order": 20,
    "uuid": ["$address.ext", "0x01", "0x041A"],
    "items": [
        "config/on",
        "config/reachable",
        "state/measured_value",
        "cap/measured_value/min",
        "cap/measured_value/max",
        "cap/measured_value/unit",
        "cap/measured_value/dimension",
        "state/lastupdated"
    ]
}

API deCONZ result:

{
    "config": {
        "battery": 100,
        "on": true,
        "reachable": true
    },
    "etag": "64fd79b6ef86579b29dce3fc7198041a",
    "lastannounced": null,
    "lastseen": "2023-09-08T15:18Z",
    "manufacturername": "_TZE200_v1jqz5cy",
    "modelid": "TS0601",
    "name": "Thermostat",
    "state": {
        "lastupdated": "2023-09-08T15:16:53.173",
        "measured_value": 6721026
    },
    "swversion": "1.0.1",
    "type": "$TYPE_CHLORINE_SENSOR",
    "uniqueid": "e0:79:8d:ff:fe:b8:b8:ef-01-041a"
}

@Smanar
Copy link
Collaborator

Smanar commented Sep 9, 2023

Whoa, congratulations, huge and complete integration.

Don't forget to add the new json file.

  • chlorine_sensor.json (with the "h", I miss all the time)
  • salt_sensor.json
  • tds_sensor.json
  • ec_sensor.json
  • orp_sensor.json
  • ph_sensor.json

All of thoses sensors are usefull ? on my side I don't see what is ec, orp and tds ...

"type": "$TYPE_CHLORINE_SENSOR",
This is not normal, with the json file in devices\generic\subdevices, you need to have "ZHAChlorine" instead

Expression in DDF: Item.val = (ZclFrame.at(3) << 32) | (ZclFrame.at(2) << 16) | (ZclFrame.at(1) << 8) | ZclFrame.at(0);
This is a workaround because deconz is not able to manage raw value, or display them in debug, it's possible the value is coded on 4 bytes and not 3, so can try with

Item.val = (ZclFrame.at(4) << 64) | (ZclFrame.at(3) << 32) | (ZclFrame.at(2) << 16) | (ZclFrame.at(1) << 8) | ZclFrame.at(0);

If you enable debug flag ZCL, we will be able to see the complete zigbee raw request, and I can decryt it if needed.

@sirinveen
Copy link
Author

Hi @Smanar

"All of thoses sensors are usefull ? on my side I don't see what is ec, orp and tds ..."

Depends your swimming pool. SALT is only useful if your swimming pool use saltwater.

Here a description of the different Sensor:

EC: Electrical Conductivity https://www.aquaread.com/sensors/ec#:~:text=EC%20or%20Electrical%20Conductivity%20of,on%20the%20concentration%20of%20ions.
ORP: Oxidation-reduction potential https://atlas-scientific.com/blog/orp-measurement-for-chlorine/
TDS: Total Dissolved Solids https://poolresearch.com/total-dissolved-solids/#:~:text=The%20ideal%20TDS%20level%20for,against%20lowering%20the%20TDS%20level.

""type": "$TYPE_CHLORINE_SENSOR",
This is not normal, with the json file in devices\generic\subdevices, you need to have "ZHAChlorine" instead"

I resolve this issue I also must include all new subdevices into constants.json "/usr/share/deCONZ/devices/generic"
Now is correct!

{
    "schema": "constants1.schema.json",

    "manufacturers" : {
        "$MF_BOSCH": "Bosch",
        "$MF_IKEA": "IKEA of Sweden",
        "$MF_LUMI": "LUMI",
        "$MF_LUTRON": "Lutron",
        "$MF_PHILIPS": "Philips",
        "$MF_SAMJIN": "Samjin",
        "$MF_SIGNIFY": "Signify Netherlands B.V.",
        "$MF_TUYA": "Tuyatec",
        "$MF_XIAOMI": "XIAOMI"
    },
    "device-types": {
        "$TYPE_AIR_PURIFIER": "ZHAAirPurifier",
        "$TYPE_AIR_QUALITY_SENSOR": "ZHAAirQuality",
        "$TYPE_CARBONDIOXIDE_SENSOR": "ZHACarbonDioxide",
        "$TYPE_CHLORINE_SENSOR": "ZHAChlorine",
        "$TYPE_EC_SENSOR": "ZHAEc",
        "$TYPE_FORMALDEHYDE_SENSOR": "ZHAFormaldehyde",
        "$TYPE_PARTICULATEMATTER_SENSOR": "ZHAParticulateMatter",
        "$TYPE_ALARM_SENSOR": "ZHAAlarm",
        "$TYPE_BATTERY_SENSOR": "ZHABattery",
        "$TYPE_COLOR_DIMMABLE_LIGHT": "Color dimmable light",
        "$TYPE_COLOR_LIGHT": "Color light",
        "$TYPE_COLOR_TEMPERATURE_LIGHT": "Color temperature light",
        "$TYPE_CONSUMPTION_SENSOR": "ZHAConsumption",
        "$TYPE_DIMMABLE_LIGHT": "Dimmable light",
        "$TYPE_DIMMABLE_PLUGIN_UNIT": "Dimmable plug-in unit",
        "$TYPE_DIMMER_SWITCH": "Dimmer switch",
        "$TYPE_DOOR_LOCK_CONTROLLER": "Door lock controller",
        "$TYPE_DOOR_LOCK": "Door Lock",
        "$TYPE_EXTENDED_COLOR_LIGHT": "Extended color light",
        "$TYPE_FIRE_SENSOR": "ZHAFire",
        "$TYPE_HUMIDITY_SENSOR": "ZHAHumidity",
        "$TYPE_LIGHT_LEVEL_SENSOR": "ZHALightLevel",
        "$TYPE_MOISTURE_SENSOR": "ZHAMoisture",
        "$TYPE_ON_OFF_LIGHT": "On/Off light",
        "$TYPE_ON_OFF_LIGHT_SWITCH": "On/Off light switch",
        "$TYPE_ON_OFF_OUTPUT": "On/Off output",
        "$TYPE_ON_OFF_PLUGIN_UNIT": "On/Off plug-in unit",
        "$TYPE_ON_OFF_SWITCH": "On/Off switch",
        "$TYPE_OPEN_CLOSE_SENSOR": "ZHAOpenClose",
        "$TYPE_ORP_SENSOR": "ZHAOrp",
        "$TYPE_PH_SENSOR": "ZHAPh",
        "$TYPE_POWER_SENSOR": "ZHAPower",
        "$TYPE_PRESENCE_SENSOR": "ZHAPresence",
        "$TYPE_PRESSURE_SENSOR": "ZHAPressure",
        "$TYPE_RANGE_EXTENDER": "Range extender",
        "$TYPE_RELATIVE_ROTARY": "ZHARelativeRotary",
        "$TYPE_SALT_SENSOR": "ZHASalt",
        "$TYPE_SMART_PLUG": "Smart plug",
        "$TYPE_SPECTRAL_SENSOR": "ZHASpectral",
        "$TYPE_SWITCH": "ZHASwitch",
        "$TYPE_TDS_SENSOR": "ZHATds",
        "$TYPE_TEMPERATURE_SENSOR": "ZHATemperature",
        "$TYPE_THERMOSTAT": "ZHAThermostat",
        "$TYPE_VIBRATION_SENSOR": "ZHAVibration",
        "$TYPE_WARNING_DEVICE": "Warning device",
        "$TYPE_WATER_LEAK_SENSOR": "ZHAWater",
        "$TYPE_WINDOW_COVERING_DEVICE": "Window covering device",
        "$TYPE_ZGP_SWITCH": "ZGPSwitch"
    }
}

image

I will check later about value with the FLAG ZCL or I must use a formula from the raw number (6688770) to find the Chlorine CL who have this range 0.0-4.0 mg/L ?!?

A other question how would be possible to calibrate this tools?
With this?

image

@BabaIsYou
Copy link
Contributor

BabaIsYou commented Sep 11, 2023

Whaou ! Nice try ! ;-)
Just take care of the number of

          "read": {
            "fn": "tuya"
          },

The read for tuya function is special and must only be specified on one item . It doesn't actually read a single value but triggers the Tuya device to report all datapoints (https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/DDF-support-Tuya-manufacturer-specific-cluster-&-How-to-know-which-datapoints-a-Tuya-device-provides%3F)

@BabaIsYou
Copy link
Contributor

BabaIsYou commented Sep 11, 2023

A other question how would be possible to calibrate this tools?
With this?

May be, or by adding a new /config/calibration item for sensors that have this function available and a write function (may not so easy if value is raw). Seems that there are two PH calibration for this device ?!

103: pH Calibration
114: PH Calibration
115: EC Calibration
116: ORP Calibration

@sirinveen
Copy link
Author

sirinveen commented Sep 11, 2023

A other question how would be possible to calibrate this tools?
With this?

May be, or by adding a new /config/calibration item for sensors that have this function available and a write function (may not so easy if value is raw). Seems that there are two PH calibration for this device ?!

103: pH Calibration 114: PH Calibration 115: EC Calibration 116: ORP Calibration

Here the list of the Datapoint (Updated)

1: TDS
2: Temperature
101: ORP
102: Chlorine
7: Battery Percentage
103: pH Calibration
104: Backlight
105: Backlight Value
10: pH Value
11: EC Value
106: pH Max Value
107: pH Min Value
108: EC Max Value
109: EC Min Value
110: ORP Max Value
111: ORP Min Value
112: Chlorine Max Value
113: Chlorine Min Value
114: PH Calibration
115: EC Calibration
116: ORP Calibration
117: Salt

For PH there is finally 3 datapoints one with 10 (only Read) and the other with 103 (EU Calibration) and 114 (Asia Calibration).
I will receive soon Calibration Solution I will test it.
For PH I think would not so difficult the number are easy to read (See Example 760 = 7.6).
For ORP and EC for the moment I don't know how to convert the raw number in ORP (-999 +999)mV and EC 0-2000μS/cm

PH Example:

image

ORP Example:

image

@sirinveen
Copy link
Author

Whaou ! Nice try ! ;-) Just take care of the number of

          "read": {
            "fn": "tuya"
          },

The read for tuya function is special and must only be specified on one item . It doesn't actually read a single value but triggers the Tuya device to report all datapoints (https://github.com/dresden-elektronik/deconz-rest-plugin/wiki/DDF-support-Tuya-manufacturer-specific-cluster-&-How-to-know-which-datapoints-a-Tuya-device-provides%3F)

I will make a new DDF to clean that.

@BabaIsYou
Copy link
Contributor

Here the list of the Datapoint

I think you have to refer here for the DP list : zigpy/zha-device-handlers#2565 (comment)

@BabaIsYou
Copy link
Contributor

BabaIsYou commented Sep 11, 2023

Tag "cap/measured_value/dimension" don't exist with the last version 2.23.0-beta

Has been changed to cap/measured_value/substance

@BabaIsYou
Copy link
Contributor

For ORP and EC for the moment I don't know how to convert the raw number in ORP (-999 +999)mV and EC 0-2000μS/cm

Seems that there could be 3 potential ranges for EC image

@Smanar
Copy link
Collaborator

Smanar commented Sep 11, 2023

I resolve this issue I also must include all new subdevices into constants.json "/usr/share/deCONZ/devices/generic"

Ha ? oups, good to know, for me this file was optionnal.

Lol, I like the new sensors

EC: Electrical Conductivity : if you want to kill someone with electricity in the swiming pool
TDS: Total Dissolved Solids it's an acid wimming pool to dissolve the corpse after ?

(I don't have swimming pool, but from my memory we were checking only ph on my old one) It's a professional product ?

Seriously you have information about the device working mode ?

  • what mean PH calibration, it s an offset or a multiplicator (or a command), if it's just an offset, it's useless, can use a config/offset in the DDF.
  • how are working min/max ? it's to trigger an alarm ?

@BabaIsYou
Copy link
Contributor

  • how are working min/max ? it's to trigger an alarm ?

Yes it is … I think it’s used from into Tuya App but can be easily made by home automation software

@Smanar
Copy link
Collaborator

Smanar commented Sep 11, 2023

But how ?
I don't see a "DP alarm", and it's managed by the device, else why it have DP for them ? can set them direclty on the app.

@BabaIsYou
Copy link
Contributor

BabaIsYou commented Sep 11, 2023

But how ? I don't see a "DP alarm", and it's managed by the device, else why it have DP for them ? can set them direclty on the app.

You're rigth ! But it's described that way image
Or the values that are given into calibration automaticaly change the range of min/max ? EC can have 3 ranges for instance.

(I don't have swimming pool, but from my memory we were checking only ph on my old one) It's a professional product ?

It can also be used for spa/jacuzzi/hotub that are more "unstable" environnements than swimming pool and you have to check for more parameters. Can also be used for big fish tanks.

i'm happy that this kind of product is on the "mass" market ... Hope it is reliable then I'll certainly buy one for my cottage's Spa, avoiding a 160 km travel each week.

@sirinveen
Copy link
Author

Here a new version of DDF without repeating function read for Tuya:

Please check @BabaIsYou if it's correct?

I also try with a other version config/offset with DP 103 and DP 114 but receive 0 like value.

image

{
          "name": "config/offset",
          "parse": {
            "dpid": 114,
            "eval": "Item.val = Attr.val;",
            "fn": "tuya"
          },
          "default": 0
        },

New DDF:

{

  "schema": "devcap1.schema.json",
  "manufacturername": "_TZE200_v1jqz5cy",
  "modelid": "TS0601",
  "vendor": "Tuya",
  "product": "Zigbee Chlorine Meter PH ORP EC TDS Salinity Temp CL",
  "sleeper": false,
  "status": "Gold",
  "path": "/devices/_TZE200_TS0601_v1jqz5cy_v10.json",
  "subdevices": [
    {
      "type": "$TYPE_TEMPERATURE_SENSOR",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0x0514"
      ],
      "items": [
        {
          "name": "attr/id"
        },
        {
          "name": "attr/lastannounced"
        },
        {
          "name": "attr/lastseen"
        },
        {
          "name": "attr/manufacturername"
        },
        {
          "name": "attr/modelid"
        },
        {
          "name": "attr/name"
        },
        {
          "name": "attr/swversion",
          "refresh.interval": 86394,
          "read": {
            "at": "0x0001",
            "cl": "0x0000",
            "ep": 0,
            "fn": "zcl"
          },
          "parse": {
            "at": "0x0001",
            "cl": "0x0000",
            "ep": 255,
            "fn": "zcl",
            "script": "tuya_swversion.js"
          }
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "config/battery",
          "refresh.interval": 3600,
          "read": {
            "fn": "tuya"
          },
          "parse": {
            "dpid": 7,
            "eval": "Item.val = Attr.val;",
            "fn": "tuya"
          },
          "default": 0
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "state/lastupdated"
        },
        {
          "name": "state/temperature",
          "refresh.interval": 3600,
          "read": {
            "fn": "tuya"
          },
          "parse": {
            "dpid": 2,
            "eval": "Item.val = (10 * Attr.val);",
            "fn": "tuya"
          },
          "default": 0
        }
      ]
    },
    {
      "type": "$TYPE_PH_SENSOR",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0x0512"
      ],
      "items": [
        {
          "name": "attr/lastannounced"
        },
        {
          "name": "attr/lastseen"
        },
        {
          "name": "attr/manufacturername"
        },
        {
          "name": "attr/modelid"
        },
        {
          "name": "attr/name"
        },
        {
          "name": "attr/swversion",
          "refresh.interval": 86400,
          "read": {
            "at": "0x0001",
            "cl": "0x0000",
            "ep": 0,
            "fn": "zcl"
          },
          "parse": {
            "at": "0x0001",
            "cl": "0x0000",
            "ep": 255,
            "fn": "zcl",
            "script": "tuya_swversion.js"
          }
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "cap/measured_value/unit",
          "static": "pH"
        },        
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "state/lastupdated"
        },
        {
          "name": "state/measured_value",
          "parse": {
            "dpid": 10,
            "eval": "Item.val = Attr.val;",
            "fn": "tuya"
          },
          "default": 0
        }
      ]
    },
    {
      "type": "$TYPE_CHLORINE_SENSOR",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0x041a"
      ],
      "items": [
        {
          "name": "attr/id"
        },
        {
          "name": "attr/lastannounced"
        },
        {
          "name": "attr/lastseen"
        },
        {
          "name": "attr/manufacturername"
        },
        {
          "name": "attr/modelid"
        },
        {
          "name": "attr/name"
        },
        {
          "name": "attr/swversion",
          "refresh.interval": 86400,
          "read": {
            "at": "0x0001",
            "cl": "0x0000",
            "ep": 0,
            "fn": "zcl"
          },
          "parse": {
            "at": "0x0001",
            "cl": "0x0000",
            "ep": 255,
            "fn": "zcl",
            "script": "tuya_swversion.js"
          }
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "cap/measured_value/max",
          "default": 0
        },
        {
          "name": "cap/measured_value/min",
          "default": 0
        },
        {
          "name": "cap/measured_value/unit",
          "static": "mg/L"
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "state/lastupdated"
        },
        {
          "name": "state/measured_value",
          "parse": {
            "dpid": 102,
            "eval": "Item.val = (ZclFrame.at(3) << 32) | (ZclFrame.at(2) << 16) | (ZclFrame.at(1) << 8) | ZclFrame.at(0);",
            "fn": "tuya"
          },
          "default": 0
        }
      ]
    },
    {
      "type": "$TYPE_ORP_SENSOR",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0x042a"
      ],
      "items": [
        {
          "name": "attr/id"
        },
        {
          "name": "attr/lastannounced"
        },
        {
          "name": "attr/lastseen"
        },
        {
          "name": "attr/manufacturername"
        },
        {
          "name": "attr/modelid"
        },
        {
          "name": "attr/name"
        },
        {
          "name": "attr/swversion",
          "refresh.interval": 86400,
          "read": {
            "at": "0x0001",
            "cl": "0x0000",
            "ep": 0,
            "fn": "zcl"
          },
          "parse": {
            "at": "0x0001",
            "cl": "0x0000",
            "ep": 255,
            "fn": "zcl",
            "script": "tuya_swversion.js"
          }
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "cap/measured_value/max",
          "description": "Maximum value of state/measured_value.",
          "default": 0
        },
        {
          "name": "cap/measured_value/min",
          "description": "Minimum value of state/measured_value.",
          "default": 0
        },
        {
          "name": "cap/measured_value/unit",
          "static": "mV"
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "state/lastupdated"
        },
        {
          "name": "state/measured_value",
          "parse": {
            "dpid": 101,
            "eval": "Item.val = (ZclFrame.at(3) << 32) | (ZclFrame.at(2) << 16) | (ZclFrame.at(1) << 8) | ZclFrame.at(0);",
            "fn": "tuya"
          },
          "default": 0
        }
      ]
    },
    {
      "type": "$TYPE_EC_SENSOR",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0x043a"
      ],
      "items": [
        {
          "name": "attr/id"
        },
        {
          "name": "attr/lastannounced"
        },
        {
          "name": "attr/lastseen"
        },
        {
          "name": "attr/manufacturername"
        },
        {
          "name": "attr/modelid"
        },
        {
          "name": "attr/name"
        },
        {
          "name": "attr/swversion",
          "refresh.interval": 86400,
          "read": {
            "at": "0x0001",
            "cl": "0x0000",
            "ep": 0,
            "fn": "zcl"
          },
          "parse": {
            "at": "0x0001",
            "cl": "0x0000",
            "ep": 255,
            "fn": "zcl",
            "script": "tuya_swversion.js"
          }
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "cap/measured_value/max",
          "description": "Maximum value of state/measured_value.",
          "default": 0
        },
        {
          "name": "cap/measured_value/min",
          "description": "Minimum value of state/measured_value.",
          "default": 0
        },
        {
          "name": "cap/measured_value/unit",
          "static": "μS/cm"
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "state/lastupdated"
        },
        {
          "name": "state/measured_value",
          "parse": {
            "dpid": 11,
            "eval": "Item.val = (ZclFrame.at(3) << 32) | (ZclFrame.at(2) << 16) | (ZclFrame.at(1) << 8) | ZclFrame.at(0);",
            "fn": "tuya"
          },
          "default": 0
        }
      ]
    },
    {
      "type": "$TYPE_TDS_SENSOR",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0x042B"
      ],
      "items": [
        {
          "name": "attr/lastannounced"
        },
        {
          "name": "attr/lastseen"
        },
        {
          "name": "attr/manufacturername"
        },
        {
          "name": "attr/modelid"
        },
        {
          "name": "attr/name"
        },
        {
          "name": "attr/swversion",
          "refresh.interval": 86400,
          "read": {
            "at": "0x0001",
            "cl": "0x0000",
            "ep": 0,
            "fn": "zcl"
          },
          "parse": {
            "at": "0x0001",
            "cl": "0x0000",
            "ep": 255,
            "fn": "zcl",
            "script": "tuya_swversion.js"
          }
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "cap/measured_value/unit",
          "static": "ppm"
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "state/lastupdated"
        },
        {
          "name": "state/measured_value",
          "parse": {
            "dpid": 1,
            "eval": "Item.val = Attr.val;",
            "fn": "tuya"
          },
          "default": 0
        }
      ]
    },
    {
      "type": "$TYPE_SALT_SENSOR",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0x040D"
      ],
      "items": [
        {
          "name": "attr/lastannounced"
        },
        {
          "name": "attr/lastseen"
        },
        {
          "name": "attr/manufacturername"
        },
        {
          "name": "attr/modelid"
        },
        {
          "name": "attr/name"
        },
        {
          "name": "attr/swversion",
          "refresh.interval": 86400,
          "read": {
            "at": "0x0001",
            "cl": "0x0000",
            "ep": 0,
            "fn": "zcl"
          },
          "parse": {
            "at": "0x0001",
            "cl": "0x0000",
            "ep": 255,
            "fn": "zcl",
            "script": "tuya_swversion.js"
          }
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "cap/measured_value/unit",
          "static": "ppm"
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "state/lastupdated"
        },
        {
          "name": "state/measured_value",
          "parse": {
            "dpid": 117,
            "eval": "Item.val = Attr.val;",
            "fn": "tuya"
          },
          "default": 0
        }
      ]
    }
  ]
}

I will try later other test but now swimming!

@Smanar
Copy link
Collaborator

Smanar commented Sep 11, 2023

If it's just an offset, you don't need to use dp, can just use something like

        {
          "name": "config/offset",
          "default": 0
        },

and

        {
          "name": "state/measured_value",
          "parse": {
            "dpid": 1,
            "eval": "Item.val = Attr.val + R.item('config/offset').val;",
            "fn": "tuya"
          },
          "default": 0
        }

the offset will be managed by deconz direclty.

@BabaIsYou
Copy link
Contributor

IMO, if I understand correctly the wiki, only one read for tuya fn is needed for the whole device. Then it's better to choose the one with the lowest refresh.interval (temperature for instance that is the more "volatile" parameter in this list) to populate all the other items at this interval.
All others have to be in the form

          "read": {"fn": "none"},
          "parse": {
            "dpid": xxx,
            "eval": "Item.val = yyy);",
            "fn": "tuya"
          },

@sirinveen
Copy link
Author

"read": {"fn": "none"},

New version:

{
  "schema": "devcap1.schema.json",
  "manufacturername": "_TZE200_v1jqz5cy",
  "modelid": "TS0601",
  "vendor": "Tuya",
  "product": "Zigbee Chlorine Meter PH ORP EC TDS Salinity Temp CL",
  "sleeper": false,
  "status": "Gold",
  "path": "/devices/_TZE200_TS0601_v1jqz5cy_v12.json",
  "subdevices": [
    {
      "type": "$TYPE_TEMPERATURE_SENSOR",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0x0514"
      ],
      "items": [
        {
          "name": "attr/id"
        },
        {
          "name": "attr/lastannounced"
        },
        {
          "name": "attr/lastseen"
        },
        {
          "name": "attr/manufacturername"
        },
        {
          "name": "attr/modelid"
        },
        {
          "name": "attr/name"
        },
        {
          "name": "attr/swversion"
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "config/battery",
          "read": {
            "fn": "none"
          },
          "parse": {
            "dpid": 7,
            "eval": "Item.val = Attr.val;",
            "fn": "tuya"
          },
          "default": 0
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "state/lastupdated"
        },
        {
          "name": "state/temperature",
          "refresh.interval": 3600,
          "read": {
            "fn": "tuya"
          },
          "parse": {
            "dpid": 2,
            "eval": "Item.val = (10 * Attr.val);",
            "fn": "tuya"
          },
          "default": 0
        }
      ]
    },
    {
      "type": "$TYPE_PH_SENSOR",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0x0512"
      ],
      "items": [
        {
          "name": "attr/lastannounced"
        },
        {
          "name": "attr/lastseen"
        },
        {
          "name": "attr/manufacturername"
        },
        {
          "name": "attr/modelid"
        },
        {
          "name": "attr/name"
        },
        {
          "name": "attr/swversion"
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "cap/measured_value/unit",
          "static": "pH"
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "state/lastupdated"
        },
        {
          "name": "state/measured_value",
          "read": {
            "fn": "none"
          },
          "parse": {
            "dpid": 10,
            "eval": "Item.val = Attr.val;",
            "fn": "tuya"
          },
          "default": 0
        }
      ]
    },
    {
      "type": "$TYPE_CHLORINE_SENSOR",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0x041a"
      ],
      "items": [
        {
          "name": "attr/id"
        },
        {
          "name": "attr/lastannounced"
        },
        {
          "name": "attr/lastseen"
        },
        {
          "name": "attr/manufacturername"
        },
        {
          "name": "attr/modelid"
        },
        {
          "name": "attr/name"
        },
        {
          "name": "attr/swversion"
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "cap/measured_value/max",
          "default": 0
        },
        {
          "name": "cap/measured_value/min",
          "default": 0
        },
        {
          "name": "cap/measured_value/unit",
          "static": "mg/L"
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "state/lastupdated"
        },
        {
          "name": "state/measured_value",
          "read": {
            "fn": "none"
          },
          "parse": {
            "dpid": 102,
            "eval": "Item.val = (ZclFrame.at(3) << 32) | (ZclFrame.at(2) << 16) | (ZclFrame.at(1) << 8) | ZclFrame.at(0);",
            "fn": "tuya"
          },
          "default": 0
        }
      ]
    },
    {
      "type": "$TYPE_ORP_SENSOR",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0x042a"
      ],
      "items": [
        {
          "name": "attr/id"
        },
        {
          "name": "attr/lastannounced"
        },
        {
          "name": "attr/lastseen"
        },
        {
          "name": "attr/manufacturername"
        },
        {
          "name": "attr/modelid"
        },
        {
          "name": "attr/name"
        },
        {
          "name": "attr/swversion"
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "cap/measured_value/max",
          "description": "Maximum value of state/measured_value.",
          "default": 0
        },
        {
          "name": "cap/measured_value/min",
          "description": "Minimum value of state/measured_value.",
          "default": 0
        },
        {
          "name": "cap/measured_value/unit",
          "static": "mV"
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "state/lastupdated"
        },
        {
          "name": "state/measured_value",
          "read": {
            "fn": "none"
          },
          "parse": {
            "dpid": 101,
            "eval": "Item.val = (ZclFrame.at(3) << 32) | (ZclFrame.at(2) << 16) | (ZclFrame.at(1) << 8) | ZclFrame.at(0);",
            "fn": "tuya"
          },
          "default": 0
        }
      ]
    },
    {
      "type": "$TYPE_EC_SENSOR",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0x043a"
      ],
      "items": [
        {
          "name": "attr/id"
        },
        {
          "name": "attr/lastannounced"
        },
        {
          "name": "attr/lastseen"
        },
        {
          "name": "attr/manufacturername"
        },
        {
          "name": "attr/modelid"
        },
        {
          "name": "attr/name"
        },
        {
          "name": "attr/swversion"
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "cap/measured_value/max",
          "description": "Maximum value of state/measured_value.",
          "default": 0
        },
        {
          "name": "cap/measured_value/min",
          "description": "Minimum value of state/measured_value.",
          "default": 0
        },
        {
          "name": "cap/measured_value/unit",
          "static": "μS/cm"
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "state/lastupdated"
        },
        {
          "name": "state/measured_value",
          "read": {
            "fn": "none"
          },
          "parse": {
            "dpid": 11,
            "eval": "Item.val = (ZclFrame.at(3) << 32) | (ZclFrame.at(2) << 16) | (ZclFrame.at(1) << 8) | ZclFrame.at(0);",
            "fn": "tuya"
          },
          "default": 0
        }
      ]
    },
    {
      "type": "$TYPE_TDS_SENSOR",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0x042B"
      ],
      "items": [
        {
          "name": "attr/lastannounced"
        },
        {
          "name": "attr/lastseen"
        },
        {
          "name": "attr/manufacturername"
        },
        {
          "name": "attr/modelid"
        },
        {
          "name": "attr/name"
        },
        {
          "name": "attr/swversion"
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "cap/measured_value/unit",
          "static": "ppm"
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "state/lastupdated"
        },
        {
          "name": "state/measured_value",
          "read": {
            "fn": "none"
          },
          "parse": {
            "dpid": 1,
            "eval": "Item.val = Attr.val;",
            "fn": "tuya"
          },
          "default": 0
        }
      ]
    },
    {
      "type": "$TYPE_SALT_SENSOR",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0x040D"
      ],
      "items": [
        {
          "name": "attr/lastannounced"
        },
        {
          "name": "attr/lastseen"
        },
        {
          "name": "attr/manufacturername"
        },
        {
          "name": "attr/modelid"
        },
        {
          "name": "attr/name"
        },
        {
          "name": "attr/swversion"
        },
        {
          "name": "attr/type"
        },
        {
          "name": "attr/uniqueid"
        },
        {
          "name": "cap/measured_value/unit",
          "static": "ppm"
        },
        {
          "name": "config/on"
        },
        {
          "name": "config/reachable"
        },
        {
          "name": "state/lastupdated"
        },
        {
          "name": "state/measured_value",
          "read": {
            "fn": "none"
          },
          "parse": {
            "dpid": 117,
            "eval": "Item.val = Attr.val;",
            "fn": "tuya"
          },
          "default": 0
        }
      ]
    }
  ]
}

@sirinveen
Copy link
Author

If it's just an offset, you don't need to use dp, can just use something like

        {
          "name": "config/offset",
          "default": 0
        },

and

        {
          "name": "state/measured_value",
          "parse": {
            "dpid": 1,
            "eval": "Item.val = Attr.val + R.item('config/offset').val;",
            "fn": "tuya"
          },
          "default": 0
        }

the offset will be managed by deconz direclty.

Now I understand @Smanar how the offset working. Not sure it's work with this device.

Here the notice how to calibrate PH / ORP / EC if you have the app and the gateway. I don't have.

Calibration methods:

•Ph calibration

  1. Pour the 7.00/4.00/10.01 calibration solutions into separate cups.
  2. Open the APP to enter the PH interface (already bound to the current device in order to operate).
  3. Select PH standard (EU standard).
  4. Put the electrode into the 7.00 solution, wait for the value to stabilise, click on calibrate, the calibration solution will be automatically recognised and 7.0 will appear, completing the 7.00 calibration.
  5. Place the electrode in the 4.00 solution, wait for the value to stabilise, click on calibrate, automatically recognise the calibration solution, 4.0 appears and the 4.00 calibration is completed.
  6. Place the electrode in the 10.01 solution, wait for the value to stabilise, click on Calibrate, the calibration solution is automatically recognised and 10.0 appears, completing the 10.01 calibration.

•ORP calibration

  1. Pour the 222mV calibration solution into the cup.
  2. Put the electrode into 222mV solution, enter the OR calibration interface, wait for the value to stabilise, click on Calibrate Set the value to 222, display calibration in progress, 222 appears, complete 222 calibration.

•EC Calibration

  1. Pour the 1413us/cm calibration solution into a cup and place the electrode in the 1413 solution,
  2. Enter the EC calibration interface, wait for the value to stabilise, click on calibrate adjust the value to 1413, display calibration in progress1413 appears, complete the 1413 calibration.
  3. Pour the 12.88ms/cm calibration solution into the cup. Put the electrode into the solution, wait for the value to stabilise, click on calibrate, set the value to 12880 display calibration in progress, 12.88 appears, complete 12.88 calibration.

How I can calibrate with deCONZ? Shall I create new subdevices with DP 114 and DP 103 for PH Calibration?

@Smanar
Copy link
Collaborator

Smanar commented Sep 16, 2023

He, yep, I don't see other method, I don't find better method, problem is only "light" device have "send request only" field
For sensor can be

        {
          "name": "config/calibration",
          "read": {
            "fn": "none"
          },
          "write": {
            "dpid": 114,
            "dt": "0x10",
            "eval": "Item.val;",
            "fn": "tuya"
          }
        },

But I don't know the type and the value to use. For this code I m using a "bool" type with 0/1.
Generaly even is the request is bad, the device send a "report" with the same dpid, so it's possible to look at it to see the correct synthax on logs.

(And need to add a new json file again, a config_calibration_item.json but this one can be used for all sensor)

@sirinveen
Copy link
Author

He, yep, I don't see other method, I don't find better method, problem is only "light" device have "send request only" field For sensor can be

        {
          "name": "config/calibration",
          "read": {
            "fn": "none"
          },
          "write": {
            "dpid": 114,
            "dt": "0x10",
            "eval": "Item.val;",
            "fn": "tuya"
          }
        },

But I don't know the type and the value to use. For this code I m using a "bool" type with 0/1. Generaly even is the request is bad, the device send a "report" with the same dpid, so it's possible to look at it to see the correct synthax on logs.

(And need to add a new json file again, a config_calibration_item.json but this one can be used for all sensor)

When I look the log info I can see type 0x02 means value

image

I change Bool with Double

{
    "schema": "resourceitem1.schema.json",
	"id": "config/calibration",
	"datatype": "Double",
	"access": "RW",
	"public": true,
	"description": "Calibrate Solution."
}

Here in DDF:

{
          "name": "config/calibration",
          "read": {
            "fn": "none"
          },
          "write": {
            "dpid": 114,
            "dt": "0x02",
            "eval": "Item.val;",
            "fn": "tuya"
          }
 },

In API I see value null. How I can write a calibration number?

image

@Smanar
Copy link
Collaborator

Smanar commented Sep 18, 2023

// Value for dp_type
// ------------------
// 0x00 	DP_TYPE_RAW 	?
// 0x01 	DP_TYPE_BOOL 	?
// 0x02 	DP_TYPE_VALUE 	4 byte unsigned integer
// 0x03 	DP_TYPE_STRING 	variable length string
// 0x04 	DP_TYPE_ENUM 	1 byte enum
// 0x05 	DP_TYPE_FAULT 	1 byte bitmap (didn't test yet)

So type 2 is classic value (so double in the json is fine)

{
          "name": "config/calibration",
          "read": {
            "fn": "none"
          },
         "parse": {"fn": "tuya", "dpid": 114, "eval": "Item.val = Attr.val;"},
          "write": {
            "dpid": 114,
            "dt": "0x2b",
            "eval": "Item.val;",
            "fn": "tuya"
          }
 },

0x02 is tuya type,converted in 0x2b for deconz type.
Have added the "parse" part for the json be able to receive the data, but not sure it's usefull, IDK if the state remain, or if it's a "one shoot" request.

For information I will be away for a week, so can't help to finish this device.

@github-actions
Copy link

As there has not been any response in 21 days, this issue has been automatically marked as stale. At OP: Please either close this issue or keep it active It will be closed in 7 days if no further activity occurs.

@github-actions github-actions bot added the stale label Oct 10, 2023
@github-actions
Copy link

As there has not been any response in 28 days, this issue will be closed. @ OP: If this issue is solved post what fixed it for you. If it is not solved, request to get this opened again.

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

No branches or pull requests

3 participants