deconz-rest-plugin icon indicating copy to clipboard operation
deconz-rest-plugin copied to clipboard

GiEXperience SMART Water Valve (_TZE200_a7sghmms)

Open BEskandari opened this issue 2 years ago • 16 comments

Device

  • Product name: GiEXperience SMART Water Valve
  • Manufacturer: _TZE200_a7sghmms
  • Model identifier: TS0601
  • Device type :
    • Other: Water Valve
  • Link to product GiEXperience SMART Water Valve

Screenshots

Node Info

img1 img2 img2a

Basic

img3 img3a img3b

Groups

img4 img4a img4b

Scenes

img5 img5a img5b img5c img5d img5e

Other: Tuya specific

img6

Other: OTAU

img7 img7a img7b

Other: Time

img8

BEskandari avatar May 02 '23 18:05 BEskandari

Could try this DDF ? You,Ll have two devices, one On/off "light" and one Consumption "sensor"

{
	"schema": "devcap1.schema.json",
	"manufacturername": ["_TZE200_a7sghmms", "_TZE200_sh1btabb"],
	"modelid": ["TS0601", "TS0601"],
	"vendor": "GIEXperience",
	"product": "Smart water valve",
	"sleeper": false,
	"status": "Gold",
	"subdevices": [{
			"type": "$TYPE_ON_OFF_OUTPUT",
			"restapi": "/lights",
			"uuid": [
				"$address.ext",
				"0x01"
			],
			"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": "state/on",
					"refresh.interval": 300,
					"read": {
						"fn": "tuya"
					},
					"write": {
						"dpid": 2,
						"dt": "0x10",
						"eval": "Item.val == 1 ? 1 : 0;",
						"fn": "tuya"
					},
					"parse": {
						"dpid": 2,
						"eval": "Item.val = Attr.val;",
						"fn": "tuya"
					},
					"default": 0
				},
				{
					"name": "config/tuya_unlock"
				},
				{
					"name": "state/reachable"
				}
			]
		},
		{
			"type": "$TYPE_CONSUMPTION_SENSOR",
			"restapi": "/sensors",
			"uuid": [
				"$address.ext",
				"0x01",
				"0x0702"
			],
			"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",
					"parse": {
						"dpid": 108,
						"eval": "Item.val = Attr.val;",
						"fn": "tuya"
					},
					"default": 0
				},
				{
					"name": "config/duration",
					"description": "Last irrigation duration",
					"parse": {
						"dpid": 114,
						"eval": "Item.val = Attr.val;",
						"fn": "tuya"
					}
				},
				{
					"name": "state/consumption",
					"description": "Rcurrent_summ_delivered",
					"parse": {
						"dpid": 111,
						"eval": "Item.val == Attr.val;",
						"fn": "tuya"
					},
					"default": 0
				},
				{
					"name": "config/reachable"
				},
				{
					"name": "state/lastupdated"
				},
				{
					"name": "config/delay",
					"description": "Cycle irrigation interval in seconds min=0 max=3600",
					"range": [0, 3600],
					"write": {
						"dpid": 104,
						"dt": "0x2b",
						"eval": "Attr.val = Item.val;",
						"fn": "tuya"
					},
					"parse": {
						"dpid": 104,
						"eval": "Item.val = Attr.val ;",
						"fn": "tuya"
					}
				},
				{
					"name": "state/seconds_remaining",
					"description": "Irrigation target, duration in seconds or capacity in litres (depending on mode) min=0 max=3600",
					"range": [0, 3600],
					"write": {
						"dpid": 104,
						"dt": "0x2b",
						"eval": "Attr.val = Item.val;",
						"fn": "tuya"
					},
					"parse": {
						"dpid": 104,
						"eval": "Item.val = Attr.val ;",
						"fn": "tuya"
					}
				}, {
					"name": "config/mode",
					"description": "Device mode: [0] duration [1] capacity",
					"write": {
						"dpid": 1,
						"dt": "0x10",
						"eval": "Item.val == '1' ? 1 : 0;",
						"fn": "tuya"
					},
					"parse": {
						"dpid": 1,
						"eval": "Item.val = String(Attr.val) ;",
						"fn": "tuya"
					}
				}
			]
		}
	]
}

BabaIsYou avatar May 03 '23 15:05 BabaIsYou

I just added to the DDF those lines twice:

"name": "attr/swversion",
"parse": {"fn": "zcl", "ep": 1, "cl": "0x0000", "at": "0x0001", "script": "tuya_swversion.js"},
"read": {"fn": "zcl", "ep": 1, "cl": "0x0000", "at": "0x0001"}

I can turn on/off the valve and have the battery level.

I have some doubt on the ZHAConsumption type sensor, because through Homebridge Deconz it gives me as below without any control on the duration. See below: Screenshot01

BEskandari avatar May 03 '23 17:05 BEskandari

I saw for the swversion but was not an issue at this step ;-) I don't know what Homebridge is displaying or not, can you have a look using REST-API (in Phoscon / help / API information) to see what is really exposed.

BabaIsYou avatar May 03 '23 19:05 BabaIsYou

The Consumption sensor could eventually be replaced by

      "type": "$TYPE_OPEN_CLOSE_SENSOR",
      "restapi": "/sensors",
      "uuid": [
        "$address.ext",
        "0x01",
        "0x0500"
      ],

instead of


		"type": "$TYPE_CONSUMPTION_SENSOR",
			"restapi": "/sensors",
			"uuid": [
				"$address.ext",
				"0x01",
				"0x0702"
			],

BabaIsYou avatar May 03 '23 19:05 BabaIsYou

REST-API for /lights:

{
    "config": {
        "groups": []
    },
    "etag": "1d9980c55c5ca365b9597d2bf16ea338",
    "hascolor": false,
    "lastannounced": null,
    "lastseen": "2023-05-03T19:03Z",
    "manufacturername": "_TZE200_a7sghmms",
    "modelid": "TS0601",
    "name": "Water Valve",
    "state": {
        "on": false,
        "reachable": true
    },
    "swversion": "1.0.8",
    "type": "On/Off output",
    "uniqueid": "a4:c1:38:17:9e:c3:8c:06-01"
}

REST-API for /sensors:

{
    "config": {
        "battery": 100,
        "delay": 0,
        "duration": null,
        "mode": "false",
        "on": true,
        "reachable": true
    },
    "etag": "c05d2ebb4c348c3abd2e8eb3fe497423",
    "lastannounced": null,
    "lastseen": "2023-05-03T19:07Z",
    "manufacturername": "_TZE200_a7sghmms",
    "modelid": "TS0601",
    "name": "Consumption 22",
    "state": {
        "consumption": 0,
        "lastupdated": "2023-05-03T16:50:15.724",
        "seconds_remaining": 0
    },
    "swversion": "1.0.8",
    "type": "ZHAConsumption",
    "uniqueid": "a4:c1:38:17:9e:c3:8c:06-01-0702"
}

Let me check $TYPE_OPEN_CLOSE_SENSOR

BEskandari avatar May 03 '23 19:05 BEskandari

By using $TYPE_OPEN_CLOSE_SENSOR REST-API for /lights:

{
    "config": {
        "groups": []
    },
    "etag": "204faf3a975f99b35e2c0b6879bf0797",
    "hascolor": false,
    "lastannounced": null,
    "lastseen": "2023-05-04T17:41Z",
    "manufacturername": "_TZE200_a7sghmms",
    "modelid": "TS0601",
    "name": "Water Valve",
    "state": {
        "on": false,
        "reachable": true
    },
    "swversion": "1.0.8",
    "type": "On/Off output",
    "uniqueid": "a4:c1:38:17:9e:c3:8c:06-01"
}

REST-API for /sensors:

{
    "config": {
        "battery": 100,
        "delay": 0,
        "duration": null,
        "mode": null,
        "on": true,
        "reachable": true
    },
    "etag": "56246383b299b40b671f3fe11dc60747",
    "lastannounced": null,
    "lastseen": "2023-05-04T17:43Z",
    "manufacturername": "_TZE200_a7sghmms",
    "modelid": "TS0601",
    "name": "OpenClose 23",
    "state": {
        "consumption": 0,
        "lastupdated": "none",
        "seconds_remaining": 0
    },
    "swversion": "1.0.8",
    "type": "ZHAOpenClose",
    "uniqueid": "a4:c1:38:17:9e:c3:8c:06-01-0500"
}

I would like to quote @ebaauw

Not sure I appreciate the full features of the device, but this looks like a dirty hack, abusing existing API attributes to mean something completely different. No API client is going to understand that, without whitelisting the device and treating it special. I won’t be doing that in Homebridge deCONZ. In fact I just introduced the capabilities and config you /lights to get rid of whitelisting lights.

Looks like you’d need a new device type and new attributes to support the device properly. That cannot be done in a DDF alone, you’d need changes to the C++ code. I’m happy to support a new device type in Homebridge deCONZ if it’s well-defined.

Actually I don't know if we can go further with this DDF and doing more than on/off

BEskandari avatar May 04 '23 17:05 BEskandari

I know that some devices are an in-between mode that's perhaps not clearly identified and that some measures are only considered under one angle (electricity) in REST-API. But from my point of view is too limited regarding to Zigbee specification. The formatting of the measure (attribute 0x0300 of cluster 0x0702) is here to precise unit of measure (from kWh, m3, BTU, liters, etc ...). Then REST-API is too limitied (missing an item to transfer unit) , and so are Third party app expectations (just KW are attendee).

Then I agree with Erik. and he is in better position than me to have C++ modification approuved.

BabaIsYou avatar May 04 '23 18:05 BabaIsYou

I rather prefer to use $TYPE_CONSUMPTION_SENSOR as the change doesn't bring any additional feature. Do we need just to add the swversion or can we do more?

@BabaIsYou if you give me the name of the existing DDF I can try to make a PR for your additions.

BEskandari avatar May 04 '23 19:05 BEskandari

I see no more addition at this step than swversion. I suggest also to change "status": "Gold", for "status": "Silver", and to put the new DDF in https://github.com/dresden-elektronik/deconz-rest-plugin/tree/f837452b4eec614746e3ba56f214b1096342a797/devices/tuya with name _TZE200_TS0601_water_valve.json

BabaIsYou avatar May 04 '23 19:05 BabaIsYou

If you add something like close #6944 in the comment of the PR, github will automatically close this issues once PR merged with a next version.

BabaIsYou avatar May 04 '23 19:05 BabaIsYou

@BabaIsYou, could you please let me know if I made the PR #6947 correctly or not? it seems stuck on a validation process.

BEskandari avatar May 06 '23 13:05 BEskandari

Yes seems good. Waiting for approval.

BabaIsYou avatar May 06 '23 13:05 BabaIsYou

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[bot] avatar May 28 '23 02:05 github-actions[bot]

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.

github-actions[bot] avatar Jun 04 '23 02:06 github-actions[bot]

Hello is this integrated???

miloit avatar Sep 12 '23 12:09 miloit

Hello is this integrated???

No, as you can see, PR is still open.

Mimiix avatar Sep 12 '23 12:09 Mimiix