homey-lib
Advanced tools
Comparing version 2.23.0 to 2.24.0
@@ -750,2 +750,90 @@ { | ||
}, | ||
"matterDevice": { | ||
"type": "object", | ||
"required": ["vendorId", "productId"], | ||
"properties": { | ||
"vendorId": { | ||
"oneOf": [ | ||
{ | ||
"type": "number", | ||
"minimum": 1, | ||
"maximum": 65520 | ||
}, | ||
{ | ||
"type": "array", | ||
"items": { | ||
"type": "number", | ||
"minimum": 1, | ||
"maximum": 65520 | ||
} | ||
} | ||
] | ||
}, | ||
"productId": { | ||
"oneOf": [ | ||
{ | ||
"type": "number", | ||
"minimum": 1, | ||
"maximum": 65535 | ||
}, | ||
{ | ||
"type": "array", | ||
"items": { | ||
"type": "number", | ||
"minimum": 1, | ||
"maximum": 65535 | ||
} | ||
} | ||
] | ||
}, | ||
"deviceVendorId": { | ||
"oneOf": [ | ||
{ | ||
"type": "number", | ||
"minimum": 1, | ||
"maximum": 65520 | ||
}, | ||
{ | ||
"type": "array", | ||
"items": { | ||
"type": "number", | ||
"minimum": 1, | ||
"maximum": 65520 | ||
} | ||
} | ||
] | ||
}, | ||
"deviceProductName": { | ||
"oneOf": [ | ||
{ | ||
"type": "string", | ||
"minLength": 1, | ||
"maxLength": 32 | ||
}, | ||
{ | ||
"type": "array", | ||
"items": { | ||
"type": "string", | ||
"minLength": 1, | ||
"maxLength": 32 | ||
} | ||
} | ||
] | ||
}, | ||
"learnmode": { | ||
"type": "object", | ||
"required": [ | ||
"instruction" | ||
], | ||
"properties": { | ||
"image": { | ||
"type": "string" | ||
}, | ||
"instruction": { | ||
"$ref": "#/definitions/i18nObject" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"zigbeeDevice": { | ||
@@ -1326,2 +1414,5 @@ "type": "object", | ||
}, | ||
"matter": { | ||
"$ref": "#/definitions/matterDevice" | ||
}, | ||
"zwave": { | ||
@@ -1373,3 +1464,4 @@ "$ref": "#/definitions/zwaveDevice" | ||
"rf433", | ||
"rf868" | ||
"rf868", | ||
"matter" | ||
] | ||
@@ -1376,0 +1468,0 @@ } |
@@ -345,5 +345,5 @@ /* eslint-disable no-restricted-properties */ | ||
// validate `appJson.drivers[].connectivity` | ||
if (driver.connectivity && (driver.connectivity.includes('lan') || driver.connectivity.includes('rf868'))) { | ||
if (driver.connectivity && (driver.connectivity.includes('lan') || driver.connectivity.includes('rf868') || driver.connectivity.includes('matter'))) { | ||
if (driver.platforms && driver.platforms.includes('cloud')) { | ||
throw new Error(`drivers.${driver.id} invalid 'connectivity': Platform 'cloud' does not support 'lan' or 'rf868'.`); | ||
throw new Error(`drivers.${driver.id} invalid 'connectivity': Platform 'cloud' does not support 'lan', 'matter' or 'rf868'.`); | ||
} | ||
@@ -369,2 +369,37 @@ } | ||
} | ||
if (driver.connectivity && driver.connectivity.includes('matter')) { | ||
if (!driver.matter) { | ||
throw new Error(`drivers.${driver.id} has 'connectivity': 'matter' and therefore requires a 'matter' object.`); | ||
} | ||
if (driver.pair) { | ||
throw new Error(`drivers.${driver.id} invalid 'pair' configuration, Matter drivers do not support custom pairing views.`); | ||
} | ||
if ( | ||
(driver.matter.deviceVendorId === undefined && driver.matter.deviceProductName !== undefined) || | ||
(driver.matter.deviceVendorId !== undefined && driver.matter.deviceProductName === undefined) | ||
) { | ||
throw new Error(`drivers.${driver.id} invalid 'matter': 'deviceVendorId' and 'deviceProductName' must be defined together.`); | ||
} | ||
const deviceJsExists = await this._fileExistsCaseSensitive(join('drivers', driver.id, 'device.js')); | ||
const deviceMjsExists = await this._fileExistsCaseSensitive(join('drivers', driver.id, 'device.mjs')); | ||
if (deviceJsExists || deviceMjsExists) { | ||
throw new Error(`drivers.${driver.id}: using a device.${deviceJsExists ? 'js' : 'mjs'} file is not supported for Matter drivers.`); | ||
} | ||
const driverJsExists = await this._fileExistsCaseSensitive(join('drivers', driver.id, 'driver.js')); | ||
const driverMjsExists = await this._fileExistsCaseSensitive(join('drivers', driver.id, 'driver.mjs')); | ||
if (driverJsExists || driverMjsExists) { | ||
throw new Error(`drivers.${driver.id}: using a driver.${driverJsExists ? 'js' : 'mjs'} file is not supported for Matter drivers.`); | ||
} | ||
} | ||
if (driver.matter && !(driver.connectivity && driver.connectivity.includes('matter'))) { | ||
throw new Error(`drivers.${driver.id} Matter drivers require 'connectivity' to include 'matter'.`); | ||
} | ||
} | ||
@@ -371,0 +406,0 @@ } |
{ | ||
"name": "homey-lib", | ||
"version": "2.23.0", | ||
"version": "2.24.0", | ||
"description": "Shared Library for Homey", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is too big to display
878134
12316