@@ -6,7 +6,7 @@ import { RegistryClass } from './Registry.js';
6
6
import { VirtualBaseElement } from './VirtualBaseElement.js' ;
7
7
8
8
export class MockSwitch extends VirtualBaseElement {
9
- async doAction ( action : unknown ) {
9
+ async doAction ( action : { [ key : string ] : any } ) {
10
10
if ( action . value != null ) { this . state . value = action . value ; }
11
11
if ( action . toggle != null ) { this . state . value = ( this . state . value ? 0 : 1 ) ; }
12
12
super . doAction ( action ) ;
@@ -17,7 +17,7 @@ export class MockSwitch extends VirtualBaseElement {
17
17
export class MockReference extends VirtualBaseElement {
18
18
private _lastState = { reference : undefined , invalue : undefined , value : 0 } ;
19
19
20
- async doAction ( action : unknown ) {
20
+ async doAction ( action : { [ key : string ] : any } ) {
21
21
if ( action . value != null ) { this . state . invalue = Number ( action . value ) ; }
22
22
if ( action . reference != null ) { this . state . reference = Number ( action . reference ) ; }
23
23
super . doAction ( action ) ;
@@ -41,7 +41,7 @@ export class MockDHT extends VirtualBaseElement {
41
41
private _defaultConfig = { readtime : 60 } ;
42
42
private _lastState = { temperature : undefined , humidity : undefined } ;
43
43
44
- setConfig ( bus : EventBusClass , config : unknown ) {
44
+ setConfig ( bus : EventBusClass , config : { [ key : string ] : any } ) {
45
45
super . setConfig ( bus , config , this . _defaultConfig ) ;
46
46
// this.state = Object.assign(this.state, {
47
47
// temperature: this.config.temperature,
@@ -83,14 +83,14 @@ export class MockDHT extends VirtualBaseElement {
83
83
export class MockValue extends VirtualBaseElement {
84
84
private _defaultConfig = { step : 1 , value : 0 } ;
85
85
86
- setConfig ( bus : EventBusClass , config : unknown ) {
86
+ setConfig ( bus : EventBusClass , config : { [ key : string ] : any } ) {
87
87
super . setConfig ( bus , config , this . _defaultConfig ) ;
88
88
this . state = Object . assign ( this . state , {
89
89
value : this . config . value
90
90
} ) ;
91
91
}
92
92
93
- async doAction ( action : unknown ) {
93
+ async doAction ( action : { [ key : string ] : any } ) {
94
94
const step = this . config . step ;
95
95
const v = this . state . value ;
96
96
if ( action . value != null ) { this . state . value = action . value ; }
@@ -114,15 +114,15 @@ export class MockDevice extends VirtualBaseElement {
114
114
return ( this . state ) ;
115
115
}
116
116
117
- async doAction ( action : unknown ) {
117
+ async doAction ( action : { [ key : string ] : any } ) {
118
118
if ( action . log !== null ) { Logger . info ( '>>' , action . log ) ; }
119
119
super . doAction ( action ) ;
120
120
}
121
121
} // MockDevice
122
122
123
123
124
124
export class MockTime extends VirtualBaseElement {
125
- async getState ( ) : Promise < unknown > {
125
+ async getState ( ) : Promise < { [ key : string ] : any } > {
126
126
const now = new Date ( ) . toISOString ( ) ;
127
127
this . state . now =
128
128
this . state . value = now . substring ( 0 , 19 ) . replace ( / T / , ' ' ) ;
@@ -133,7 +133,7 @@ export class MockTime extends VirtualBaseElement {
133
133
export class MockBL0937 extends VirtualBaseElement {
134
134
private _defaultConfig = { step : 1 , value : 0 } ;
135
135
136
- setConfig ( bus : EventBusClass , config : unknown ) {
136
+ setConfig ( bus : EventBusClass , config : { [ key : string ] : any } ) {
137
137
super . setConfig ( bus , config , this . _defaultConfig ) ;
138
138
}
139
139
@@ -152,7 +152,7 @@ export class MockBL0937 extends VirtualBaseElement {
152
152
return ( this . state ) ;
153
153
}
154
154
155
- async doAction ( action : unknown ) {
155
+ async doAction ( action : { [ key : string ] : any } ) {
156
156
if ( ( action . mode === 'current' ) || ( action . mode === 'voltage' ) ) {
157
157
this . state . mode = action . mode ;
158
158
}
@@ -168,12 +168,12 @@ export class MockStandard extends VirtualBaseElement {
168
168
super ( typeName , id ) ;
169
169
}
170
170
171
- setConfig ( bus : EventBusClass , config : unknown ) {
171
+ setConfig ( bus : EventBusClass , config : { [ key : string ] : any } ) {
172
172
super . setConfig ( bus , config ) ;
173
173
this . state . value = config . value || 0 ;
174
174
}
175
175
176
- async doAction ( action : unknown ) {
176
+ async doAction ( action : { [ key : string ] : any } ) {
177
177
super . doAction ( action ) ;
178
178
if ( action . value != null ) { this . state . value = action . value ; }
179
179
if ( action . mode != null ) { this . state . mode = action . mode ; }
@@ -187,14 +187,14 @@ export class MockTimer extends VirtualBaseElement {
187
187
restart = false ;
188
188
startTime = Date . now ( ) ;
189
189
190
- setConfig ( bus : EventBusClass , config : unknown ) {
190
+ setConfig ( bus : EventBusClass , config : { [ key : string ] : any } ) {
191
191
super . setConfig ( bus , config ) ;
192
192
this . restart = Boolean ( config . restart ) ;
193
193
this . state . value = config . value || 0 ;
194
194
this . state . mode = config . mode || 'timer' ;
195
195
}
196
196
197
- async doAction ( action : unknown ) {
197
+ async doAction ( action : { [ key : string ] : any } ) {
198
198
super . doAction ( action ) ;
199
199
if ( action . mode != null ) { this . state . mode = action . mode ; }
200
200
if ( action . start != null ) {
@@ -203,7 +203,7 @@ export class MockTimer extends VirtualBaseElement {
203
203
}
204
204
}
205
205
206
- async getState ( ) : Promise < unknown > {
206
+ async getState ( ) : Promise < { [ key : string ] : any } > {
207
207
if ( this . state . mode === 'on' ) {
208
208
this . state . value = 1 ;
209
209
} else if ( this . state . mode === 'off' ) {
0 commit comments