kivancsikert / ugly-duckling

Firmware for FarmHub devices
0 stars 0 forks source link

Publish device ID #156

Closed lptr closed 3 months ago

lptr commented 3 months ago

We now track a device ID in device-config.json:

{
  "instance": "test-mk6-3",
  "id": "UD0601-003",  // <-- this
  "peripherals": [
    // ...
  ]
}

It now appears in the init MQTT message the device sends on start:

{
    "type": "ugly-duckling",
    "model": "mk6",
    "id": "UD0601-003",
    "instance": "test-mk6-3",
    "mac": "34:85:18:50:0b:48",
    "deviceConfig": {
        "id": "UD0601-003",
        "instance": "test-mk6-3",
        // ...
    },
    // ...
}

Note the "id" field is also part of the published deviceConfig, but this redundancy is acceptable, and it helps separate where the ID is defined from what it is. We might want to move it to someplace else later on, such as a hw.json file.