Skip to content

Commit

Permalink
Model name now provided by API
Browse files Browse the repository at this point in the history
  • Loading branch information
dkerr64 committed Dec 2, 2023
1 parent 4327684 commit a7ac15e
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 12 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ YoLink status is retrieved over the internet. While the plugin maintains a statu
"config": {
"hide": true,
"name": "YoLink Hub",
"model": "YS1603-UC",
"refreshAfter": 14500,
"doublePress": 800,
"nOutlets": 5,
Expand Down Expand Up @@ -152,7 +151,6 @@ YoLink status is retrieved over the internet. While the plugin maintains a statu
* **config** *(optional)*: Object with settings specific for this device:
* **hide** *(optional)*: Hide this device from Homebridge/HomeKit. You might want to do this to suppress the "device not supported" warning message in the log. Defaults to false. See Device Notes below for Thermometer / Hydrometer for settings specific to that device.
* **name** *(optional)*: Override the name provided by YoLink for the device, this is what is shown in the Homebridge UI accessories page.
* **model** *(optional)*: YoLink does not provide device model number when requesting device information. If you want to keep a record of that and show it in the Homebridge accessories setting page then you can set it here, for example the original YoLink leak sensor has a model number of "YS7903-UC". This is a purely cosmetic setting with no functional purpose.
* **refreshAfter** *(optional)*: Device specific override of global *refreshAfter*, see above. Defaults to global setting.
* **doublePress** *(optional)*: Device specific override of global *doublePress*, see above. Defaults to global setting.
* **nOutlets** *(optional)*: For power strip or multi-outlet devices, number of controllable outlets. See device notes below.
Expand Down
8 changes: 0 additions & 8 deletions config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,6 @@
"default": "",
"description":"This will override the device name returned by YoLink for display in the Homebridge accessories page"
},
"model": {
"title": "Device Model Number",
"type": "string",
"required": false,
"default": "",
"description": "Model number is not available from the YoLink API so you can optionally add text here for Homebridge / HomeKit"
},
"refreshAfter": {
"title": "Refresh time for data from YoLink server (override global setting)",
"type": "number",
Expand Down Expand Up @@ -361,7 +354,6 @@
"devices[].deviceId",
"devices[].config.hide",
"devices[].config.name",
"devices[].config.model",
"devices[].config.refreshAfter",
"devices[].config.doublePress",
"devices[].config.nOutlets",
Expand Down
4 changes: 2 additions & 2 deletions src/platformAccessory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class YoLinkPlatformAccessory {
.setCharacteristic(platform.Characteristic.Manufacturer, 'YoLink')
.setCharacteristic(platform.Characteristic.Name, device.name)
.setCharacteristic(platform.Characteristic.FirmwareRevision, String(device.config?.version))
.setCharacteristic(platform.Characteristic.Model, String(device.config?.model ?? (device.modelName ?? 'n/a')))
.setCharacteristic(platform.Characteristic.Model, String(device.modelName ?? 'n/a'))
.setCharacteristic(platform.Characteristic.ProductData, `deviceId: ${device.deviceId}`)
// YoLink does not return device serial number in the API, use deviceId instead.
.setCharacteristic(platform.Characteristic.SerialNumber, device.deviceId);
Expand Down Expand Up @@ -98,7 +98,7 @@ export class YoLinkPlatformAccessory {
*/
initializeDeviceVars(platform: YoLinkHomebridgePlatform, device: YoLinkDevice) {
device.data = {};
device.deviceMsgName = `${device.name} (${device.deviceId})`;
device.deviceMsgName = `${device.name} / ${device.modelName} (${device.deviceId})`;
device.lastReportAtTime = 0;
device.config.refreshAfter ??= platform.config.refreshAfter;
device.config.enableExperimental = platform.makeBoolean(device.config.enableExperimental, platform.config.enableExperimental);
Expand Down

0 comments on commit a7ac15e

Please sign in to comment.