Skip to content

Commit

Permalink
Updates 24.01.24 #2 (#344)
Browse files Browse the repository at this point in the history
  • Loading branch information
Apollon77 authored Jan 24, 2025
1 parent 4dee263 commit 6ee197a
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 10 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ With the ioBroker Matter Adapter it is possible to map the following use cases:
-->

## Changelog

### __WORK IN PROGRESS__
* (@Apollon77) Added OPEN state for all Door Locks to open door again
* (@Apollon77) Fixed Thermostat initialization when no AUTO mode is supported
* (@Apollon77) Enhanced Enum state display in UI

### 0.4.3 (2025-01-24)
* (@bluefox) Optimized UI
* (@Apollon77) Allows to turn light on/off via the dimming level as Zigbee adapter does
Expand Down
2 changes: 1 addition & 1 deletion src/lib/JsonConfigUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export function convertDataToJsonConfig(data: StructuredJsonFormData): JsonFormS
foreign: true,
label: tabItem.substring(12),
addColon: true,
controlDelay: 500,
controlDelay: 1000,
oid: '', // oid will be overwritten by data[key][subKey]
...data[tab][tabItem],
};
Expand Down
14 changes: 13 additions & 1 deletion src/lib/devices/GenericDevice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,8 @@ export abstract class GenericDevice extends EventEmitter {
return 'slider';
}
return 'number';
} else if (valueType === ValueType.Enum) {
return 'number';
}
return 'input';
}
Expand All @@ -674,7 +676,7 @@ export abstract class GenericDevice extends EventEmitter {
keys.reverse();
}
keys.forEach(property => {
const { name, unit, write, read, min, max } = this.#properties[property];
const { valueType, name, unit, write, read, min, max } = this.#properties[property];
states[`__iobstate__${name}`] = {
oid: write ?? read,
unit,
Expand All @@ -683,6 +685,16 @@ export abstract class GenericDevice extends EventEmitter {
readOnly: !write,
control: this.#determineControlType(property),
};
// Workaround until "control: select" is supported in JSONConfig
if (valueType === ValueType.Enum) {
const stateObject = this.#registeredStates.find(obj => obj.propertyType === property);
const modes = stateObject?.modes;
if (modes) {
states.__smalltext__AllowedValues = `Allowed values: ${Object.entries(modes)
.map(([key, value]) => `${key} (${value})`)
.join(', ')}`;
}
}
if (includeObjectIds) {
if (write !== read && write && read) {
states[`__smalltext__${name}`] = `Write: ${write}, Read: ${read}`;
Expand Down
12 changes: 5 additions & 7 deletions src/matter/to-iobroker/DoorLockToIoBroker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,11 @@ export class DoorLockToIoBroker extends GenericElectricityDataDeviceToIoBroker {
attributeName: 'lockState',
convertValue: value => value === DoorLock.LockState.Unlocked,
});
if (this.#unboltingSupported) {
this.enableDeviceTypeStateForAttribute(PropertyType.Open, {
changeHandler: async () => {
await this.appEndpoint.getClusterClient(DoorLock.Complete)?.unlockDoor({});
},
});
}
this.enableDeviceTypeStateForAttribute(PropertyType.Open, {
changeHandler: async () => {
await this.appEndpoint.getClusterClient(DoorLock.Complete)?.unlockDoor({});
},
});
return super.enableDeviceTypeStates();
}

Expand Down
1 change: 1 addition & 0 deletions src/matter/to-iobroker/ThermostatToIoBroker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ export class ThermostatToIoBroker extends GenericElectricityDataDeviceToIoBroker
await this.ioBrokerDevice.updateLevel(this.temperatureFromMatter(coolSetpoint));
}
}
return ioMode;
}
},
changeHandler: async value => {
Expand Down
2 changes: 1 addition & 1 deletion src/matter/to-matter/ThermostatToMatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export class ThermostatToMatter extends GenericDeviceToMatter {
: hasHeating
? MatterThermostat.ControlSequenceOfOperation.HeatingOnly
: MatterThermostat.ControlSequenceOfOperation.CoolingOnly,
minSetpointDeadBand: 0,
minSetpointDeadBand: this.#supportedModes.includes(ThermostatMode.Auto) ? 0 : undefined,
absMinHeatSetpointLimit: hasHeating ? this.convertTemperatureValue(7) : undefined,
absMaxHeatSetpointLimit: hasHeating ? this.convertTemperatureValue(30) : undefined,
absMinCoolSetpointLimit: hasCooling ? this.convertTemperatureValue(16) : undefined,
Expand Down

0 comments on commit 6ee197a

Please sign in to comment.