diff --git a/DEVICES.md b/DEVICES.md index e926826..7501670 100644 --- a/DEVICES.md +++ b/DEVICES.md @@ -433,19 +433,20 @@ In [brackets] is given the class name of device. ### Lock [lock] -| R | Name | Role | Unit | Type | Wr | Ind | Mult | Regex | -|---|-----------|-------------------------------|------|---------|----|-----|------|------------------------------------------------------------------------------| -| * | SET | switch.lock | | boolean | W | | | `/^switch\.lock$/` | -| | ACTUAL | state | | boolean | - | | | `/^state$/` | -| | OPEN | button | | boolean | W | | | | -| | DIRECTION | indicator.direction | | boolean | | X | | `/^indicator\.direction$/` | -| | DIRECTION | value.direction | | number | | | | `/^(indicator|value)\.direction$/` | -| | WORKING | indicator.working | | | | X | | `/^indicator\.working$/` | -| | UNREACH | indicator.maintenance.unreach | | boolean | | X | | `/^indicator(\.maintenance)?\.unreach$/` | -| | LOWBAT | indicator.maintenance.lowbat | | boolean | | X | | `/^indicator(\.maintenance)?\.lowbat$|^indicator(\.maintenance)?\.battery$/` | -| | MAINTAIN | indicator.maintenance | | boolean | | X | | `/^indicator\.maintenance$/` | -| | ERROR | indicator.error | | | | X | | `/^indicator\.error$/` | -| | BATTERY | value.battery | % | number | - | | | `/^value\.battery$/` | +| R | Name | Role | Unit | Type | Wr | Ind | Mult | Regex | +|---|------------|-------------------------------|------|---------|----|-----|------|------------------------------------------------------------------------------| +| * | SET | switch.lock | | boolean | W | | | `/^switch\.lock$/` | +| | ACTUAL | state | | boolean | - | | | `/^state$/` | +| | OPEN | button | | boolean | W | | | | +| | DOOR_STATE | sensor.door | | boolean | - | | | `/^state?$|^state(\.door)?$|^sensor(\.door)?/` | +| | DIRECTION | indicator.direction | | boolean | | X | | `/^indicator\.direction$/` | +| | DIRECTION | value.direction | | number | | | | `/^(indicator|value)\.direction$/` | +| | WORKING | indicator.working | | | | X | | `/^indicator\.working$/` | +| | UNREACH | indicator.maintenance.unreach | | boolean | | X | | `/^indicator(\.maintenance)?\.unreach$/` | +| | LOWBAT | indicator.maintenance.lowbat | | boolean | | X | | `/^indicator(\.maintenance)?\.lowbat$|^indicator(\.maintenance)?\.battery$/` | +| | MAINTAIN | indicator.maintenance | | boolean | | X | | `/^indicator\.maintenance$/` | +| | ERROR | indicator.error | | | | X | | `/^indicator\.error$/` | +| | BATTERY | value.battery | % | number | - | | | `/^value\.battery$/` | ### Media [mediaPlayer] @@ -648,8 +649,8 @@ In [brackets] is given the class name of device. ### Volume [volume] | R | Name | Role | Unit | Type | Wr | Min | Max | Ind | Mult | Regex | |---|----------|-------------------------------|------|---------|----|-----|-----|-----|------|------------------------------------------------------------------------------| -| * | SET | level.volume | | number | W | m | M | | | `/^level\.volume$/` | -| | ACTUAL | value.volume | | number | - | m | M | | | `/^value\.volume$/` | +| * | SET | level.volume | % | number | W | m | M | | | `/^level\.volume$/` | +| | ACTUAL | value.volume | % | number | - | m | M | | | `/^value\.volume$/` | | | MUTE | media.mute | | boolean | W | | | | | `/^media\.mute$/` | | | WORKING | indicator.working | | | | | | X | | `/^indicator\.working$/` | | | UNREACH | indicator.maintenance.unreach | | boolean | | | | X | | `/^indicator(\.maintenance)?\.unreach$/` | diff --git a/README.md b/README.md index 23b5f26..76f48e2 100644 --- a/README.md +++ b/README.md @@ -97,8 +97,9 @@ if (controls) { ## Changelog ### **WORK IN PROGRESS** - - (@GermanBluefox) Added detection of `level.direction` +- (@Apollon77) Added door state for device type "lock" +- (@Apollon77) Added default unit for volume states ### 4.1.1 (2024-12-15) - (@Apollon77) Fixed default unit for Illuminance to "lux" diff --git a/src/TypePatterns.ts b/src/TypePatterns.ts index f3b8b3c..e5fa0e2 100644 --- a/src/TypePatterns.ts +++ b/src/TypePatterns.ts @@ -2309,6 +2309,15 @@ export const patterns: { [key: string]: InternalPatternControl } = { noSubscribe: true, defaultRole: 'button', }, + { + role: /^state?$|^state(\.door)?$|^sensor(\.door)?/, + indicator: false, + type: StateType.Boolean, + write: false, + name: 'DOOR_STATE', + required: false, + defaultRole: 'sensor.door', + }, SharedPatterns.direction, SharedPatterns.direction_enum, SharedPatterns.working, @@ -2562,6 +2571,7 @@ export const patterns: { [key: string]: InternalPatternControl } = { name: 'SET', required: true, defaultRole: 'level.volume', + defaultUnit: '%', }, // optional { @@ -2574,6 +2584,7 @@ export const patterns: { [key: string]: InternalPatternControl } = { name: 'ACTUAL', required: false, defaultRole: 'value.volume', + defaultUnit: '%', }, { role: /^media\.mute$/,