Skip to content

Commit

Permalink
Door state and volume units
Browse files Browse the repository at this point in the history
* Added door state for device type "lock"
* Added default unit for volume states
  • Loading branch information
Apollon77 committed Jan 22, 2025
1 parent 2b548ea commit 4a0ffd8
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 16 deletions.
31 changes: 16 additions & 15 deletions DEVICES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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$/` |
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
11 changes: 11 additions & 0 deletions src/TypePatterns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -2562,6 +2571,7 @@ export const patterns: { [key: string]: InternalPatternControl } = {
name: 'SET',
required: true,
defaultRole: 'level.volume',
defaultUnit: '%',
},
// optional
{
Expand All @@ -2574,6 +2584,7 @@ export const patterns: { [key: string]: InternalPatternControl } = {
name: 'ACTUAL',
required: false,
defaultRole: 'value.volume',
defaultUnit: '%',
},
{
role: /^media\.mute$/,
Expand Down

0 comments on commit 4a0ffd8

Please sign in to comment.