Skip to content

Commit

Permalink
File State deprecations and Switch fix (#57)
Browse files Browse the repository at this point in the history
* Adjust camera states, remove file

* Adjust sensor.switch

* Changelog

* adjustes test data

* fix tests
  • Loading branch information
Apollon77 authored Nov 30, 2024
1 parent ad56c80 commit eff74fd
Show file tree
Hide file tree
Showing 5 changed files with 366 additions and 209 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ if (controls) {
-->

## Changelog

### __WORK IN PROGRESS__
* (Apollon77) Remove File tate type
* (Apollon77) Adjust Camera states to remove Binary state and replace by link
* (Apollon77) Fix role for ACTUAL state for socket

### 4.0.1 (2024-07-26)
* (Apollon77) Fix Electricity states for light type
* (Apollon77) Add Electricity states for more types
Expand Down
10 changes: 5 additions & 5 deletions src/TypePatterns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2122,12 +2122,12 @@ export const patterns: { [key: string]: InternalPatternControl } = {
camera: {
states: [
{
role: /^camera(\.\w+)?$/,
role: /^link\.camera(\.\w+)?$/,
indicator: false,
type: StateType.File,
name: 'FILE',
type: StateType.String,
name: 'URL',
required: true,
defaultRole: 'camera',
defaultRole: 'link.camera',
},
// optional
{
Expand Down Expand Up @@ -2674,7 +2674,7 @@ export const patterns: { [key: string]: InternalPatternControl } = {
write: false,
name: 'ACTUAL',
required: false,
defaultRole: 'switch',
defaultRole: 'sensor.switch',
},
...Object.values(ElectricityPatterns),
SharedPatterns.working,
Expand Down
1 change: 0 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ export enum StateType {
Number = 'number',
String = 'string',
Boolean = 'boolean',
File = 'file',
}

export interface InternalDetectorState {
Expand Down
7 changes: 3 additions & 4 deletions test/cameras.0.cameras.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@
"common": {
"name": "Floor camera",
"desc": "Floor camera",
"role": "camera",
"type": "file"
"role": "link.camera",
"type": "string"
},
"binary": true,
"type": "state",
"native": {}
}
}
}
Loading

0 comments on commit eff74fd

Please sign in to comment.