mirror of
https://github.com/danieldemus/openhab-addons
synced 2026-07-29 12:34:21 +02:00
[matter] Prevent Thermostat bridge failures (#21064)
Matter.js 0.17 implemented strict data validate for thermostats that we could violate, preventing them from being added to the bridge. Signed-off-by: Dan Cunningham <dan@digitaldan.com>
This commit is contained in:
-3
@@ -27,9 +27,6 @@ export class CustomThermostatServer extends ThermostatServer {
|
||||
minSetpointDeadBand: 0,
|
||||
} as const;
|
||||
|
||||
static readonly DEFAULTS = {
|
||||
} as const;
|
||||
|
||||
static selectFeatures(values: any): Thermostat.Feature[] {
|
||||
const feats: Thermostat.Feature[] = [];
|
||||
let controlSeq = -1;
|
||||
|
||||
+19
-3
@@ -18,9 +18,25 @@ export class ThermostatDeviceType extends BaseDeviceType {
|
||||
}
|
||||
|
||||
override defaultClusterValues(userValues: Record<string, any>) {
|
||||
const defaults: Record<string, any> = {
|
||||
thermostat: CustomThermostatServer.DEFAULTS,
|
||||
const thermostat = userValues.thermostat ?? {};
|
||||
const hasHeating = thermostat.occupiedHeatingSetpoint !== undefined;
|
||||
const hasCooling = thermostat.occupiedCoolingSetpoint !== undefined;
|
||||
|
||||
const thermostatDefaults: Record<string, any> = {
|
||||
...CustomThermostatServer.DEFAULTS_COMMON,
|
||||
};
|
||||
if (hasHeating) {
|
||||
Object.assign(thermostatDefaults, CustomThermostatServer.DEFAULTS_HEAT);
|
||||
}
|
||||
if (hasCooling) {
|
||||
Object.assign(thermostatDefaults, CustomThermostatServer.DEFAULTS_COOL);
|
||||
}
|
||||
if (hasHeating && hasCooling) {
|
||||
Object.assign(thermostatDefaults, CustomThermostatServer.DEFAULTS_AUTO);
|
||||
}
|
||||
|
||||
return {
|
||||
thermostat: thermostatDefaults,
|
||||
};
|
||||
return defaults;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user