Unsigned settings for a byte

I am trying to create a zwave driver that has a setting that is 1 byte with values from 0 to 255. When I try to compile the driver.settings.compose.json file with this in it:

      {
        "id": "dimmingSpeedUpRemote",
        "type": "number",
        "label": {
          "en": "Dimming Speed Up - Remote (#1)",
          "nl": ""
        },
        "hint": {
          "en": "",
          "nl": ""
        },
        "zwave": {
          "index": 1,
          "size": 1
        },
        "attr": {
          "min": 0,
          "max": 254
        },
        "value": 25
      },

I get an error:

âś– App did not validate against level `debug`:
âś– Error: Value cannot be signed: VZW31, dimmingSpeedUpRemote. Max value: 127, actual value: 254
    at App._validate (/usr/local/lib/node_modules/homey/lib/App.js:132:13)
    at async App.install (/usr/local/lib/node_modules/homey/lib/App.js:802:19)
    at async App.runRemote (/usr/local/lib/node_modules/homey/lib/App.js:199:21)
    at async exports.handler (/usr/local/lib/node_modules/homey/bin/cmds/app/run.js:43:5)

how do I setup a byte to be unsigned?

Thanks

Z-Wave technically is a “Signed” number protocol (range from -128 (negative) till 127 (positive)).
If a setting is used as “Unsigned” (range from 0 till 255) like you want to use, then a flag has to be enabled, tried to find any documentation but I guess it slipped through the cracks somewhere.
Most manufacturers just increase the byte size to still use the “Signed” number way, or just limit the setting to 127 instead 255, but not all do.
But to enable the setting to be used as unsigned add this flag into your "zwave" object:
"signed": false

Example of the z-wave object in the setting:

"zwave": {
  "index": 1,
  "size": 1,
  "signed": false
}
1 Like

@Caseda Thank you very much, sir. That worked like a charm and is just what I was looking for.

And for future reference, it is now added into the Z-Wave documentation:

did you just add it? I felt so embarrased today when I was re-reading that page and saw that it was so plainly laid out. :slight_smile:

Nah, I asked Athom to add it just after your question.

1 Like