Skip to content

Add DDF for MHCOZY ZG-005-RF - #7310

Merged
manup merged 7 commits into
dresden-elektronik:masterfrom
ebaauw:mhcozy
Dec 18, 2023
Merged

manup merged 7 commits into
dresden-elektronik:masterfrom
ebaauw:mhcozy

Conversation

@ebaauw

@ebaauw ebaauw commented Oct 20, 2023 •

Copy link
Copy Markdown
Collaborator

See #7309.

Initial support is quite straightforward, see resources below.

I want to expose the button mode (values: toggle, state, momentary) and, if we can reverse engineer it, the device mode (values: self-locking, interlock; jog), but I'm a bit lost in the various config attributes: clickmode vs devicemode vs mode. Neither are currently supported for lights attributes, and I don't think the API checks for valid values when PUTting these for /sensors resources. I think we'd need corresponding capabilities attributes to list the possible values.

Also these modes are for all endpoints. In /devices I would expose these on the main device. Not sure whether to expose these on all /lights resources, or only on the first.

I'm not sure if we already have a standard how we name DDFs for devices using the Tuya convention. I've seen, what I assume is the same device on Amazon an AliExpress, which different (commercial) manufacturer name and model identifier. I don't know if these use the same Manufacturer Name and Model Identifier values.

{
  "config": {
    "groups": [
      "0"
    ],
    "on": {
      "startup": false
    }
  },
  "etag": "501be1375a3277518ddf91ec052b1d90",
  "hascolor": false,
  "lastannounced": null,
  "lastseen": "2023-10-20T11:10Z",
  "manufacturername": "MHCOZY",
  "modelid": "ZG-005-RF",
  "name": "Relay 1",
  "state": {
    "on": false,
    "reachable": true
  },
  "swversion": "1.1.0",
  "type": "On/Off output",
  "uniqueid": "a4:c1:38:22:67:96:ec:15-01"
}
{
  "config": {
    "groups": [
      "0"
    ],
    "on": {
      "startup": false
    }
  },
  "etag": "501be1375a3277518ddf91ec052b1d90",
  "hascolor": false,
  "lastannounced": null,
  "lastseen": "2023-10-20T11:10Z",
  "manufacturername": "MHCOZY",
  "modelid": "ZG-005-RF",
  "name": "Relay 2",
  "state": {
    "on": false,
    "reachable": true
  },
  "swversion": "1.1.0",
  "type": "On/Off output",
  "uniqueid": "a4:c1:38:22:67:96:ec:15-02"
}
{
  "config": {
    "groups": [
      "0"
    ],
    "on": {
      "startup": false
    }
  },
  "etag": "501be1375a3277518ddf91ec052b1d90",
  "hascolor": false,
  "lastannounced": null,
  "lastseen": "2023-10-20T11:10Z",
  "manufacturername": "MHCOZY",
  "modelid": "ZG-005-RF",
  "name": "Relay 3",
  "state": {
    "on": false,
    "reachable": true
  },
  "swversion": "1.1.0",
  "type": "On/Off output",
  "uniqueid": "a4:c1:38:22:67:96:ec:15-03"
}
{
  "config": {
    "groups": [
      "0"
    ],
    "on": {
      "startup": "previous"
    }
  },
  "etag": "6d4d6840823cf39cb6627098ae94bcfe",
  "hascolor": false,
  "lastannounced": null,
  "lastseen": "2023-10-20T11:10Z",
  "manufacturername": "MHCOZY",
  "modelid": "ZG-005-RF",
  "name": "Relay 4",
  "state": {
    "on": false,
    "reachable": true
  },
  "swversion": "1.1.0",
  "type": "On/Off output",
  "uniqueid": "a4:c1:38:22:67:96:ec:15-04"
}

@ebaauw ebaauw added Device Request Device Improvement Additional tag to attach to a existing issue. labels Oct 20, 2023
@ebaauw ebaauw added this to the v2.24.2-beta milestone Oct 20, 2023
@ebaauw
ebaauw requested review from Smanar and manup October 20, 2023 11:31
@Smanar

Smanar commented Oct 20, 2023 •

Copy link
Copy Markdown
Collaborator

For me not a good idea to change model id and manufacture name. It's alredy a problem for lidl with user not able to reconize their own device (and it's not possible for devs too if this one don't have access to the GUI). And we had some issue with that in c++ core with device that fail some checks with value "randomly patched" during core evolution, it's a field too critic to be patched, just for estetic reasons.

And can have tommorow the same device but on another brand called ZG-008-XY

Good question about "config" for "light", I have this problem too, and I m not sure creating a ZHASensor is the better idea. But with this way you can put all the config on the "sensor" (and only 1 created), so not a problem for that

Also these modes are for all endpoints. In /devices I would expose these on the main device. Not sure whether to expose these on all /lights resources, or only on the first.

And about

I'm not sure if we already have a standard how we name DDFs for devices using the Tuya convention. I've seen, what I assume is the same device on Amazon an AliExpress, which different (commercial) manufacturer name and model identifier. I don't know if these use the same Manufacturer Name and Model Identifier values.

Never make assumptions with Tuya ^^

@ebaauw

ebaauw commented Dec 15, 2023

Copy link
Copy Markdown
Collaborator Author

Now basing manufacturername and modelid on Manufacturer Name and Model Identifier. The real (non-Tuya) model id is exposed as productid. See below:

{
  "config": {
    "groups": [],
    "on": {
      "startup": "previous"
    }
  },
  "etag": "f3cd380fbc54272565d1e70ab84f8bf8",
  "hascolor": false,
  "lastannounced": null,
  "lastseen": "2023-12-15T10:29Z",
  "manufacturername": "_TZ3000_u3oupgdy",
  "modelid": "TS0004",
  "name": "On/Off output 8",
  "productid": "ZG-005-RF",
  "state": {
    "on": false,
    "reachable": true
  },
  "swversion": "1.1.0",
  "type": "On/Off output",
  "uniqueid": "a4:c1:38:22:67:96:ec:15-01"
}

@Smanar

Smanar commented Dec 15, 2023

Copy link
Copy Markdown
Collaborator

Nice, on my side I prefer ^^, this solution is perfect for me.

@manup
manup merged commit e9f634d into dresden-elektronik:master Dec 18, 2023
@ebaauw
ebaauw deleted the mhcozy branch December 18, 2023 10:26
@FhemiR

FhemiR commented Dec 22, 2023

Copy link
Copy Markdown

I have tested it, I'm not sure if it is related to deconz-rest or is it a HW issue, but the device is time to time not reachable, it keeps the last state however. It comes back online again after a while however.

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

Labels

Device Improvement Additional tag to attach to a existing issue. Device Request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants