@@ -39,19 +39,19 @@ class Programs {
39
39
this . weather = Weather . getInstance ( ) ;
40
40
this . weather . setRainingCallback ( this . stop_all_programs . bind ( this ) ) ;
41
41
const list = await this . adapter . getChannelsAsync ( device_name ) ;
42
- this . adapter . log . debug ( "channel list for programs: " + JSON . stringify ( list ) ) ;
42
+ gadapter . log . debug ( "Channel list for programs: " + JSON . stringify ( list ) ) ;
43
43
for ( let p of list ) {
44
44
gadapter . log . debug ( `Getting states for channel ${ p . common . name } ` ) ;
45
45
const slist = await this . adapter . getStatesOfAsync ( device_name , p . common . name ) ;
46
46
//gadapter.log.info(`SObj: ${JSON.stringify(slist)}`);
47
47
var a = { } ;
48
48
for ( let s of slist ) {
49
- this . adapter . log . debug ( `Getting value for state ${ s . common . name } (id: ${ s . _id } )` ) ;
49
+ gadapter . log . debug ( `Getting value for state ${ s . common . name } (id: ${ s . _id } )` ) ;
50
50
const obj = await this . adapter . getStateAsync ( s . _id ) ;
51
51
if ( s . common . name == 'running' ) {
52
52
await this . adapter . subscribeStatesAsync ( s . _id ) ;
53
53
}
54
- this . adapter . log . info ( `state value ${ s . _id } : ` + JSON . stringify ( obj ) ) ;
54
+ this . adapter . log . debug ( `State value ${ s . _id } : ` + JSON . stringify ( obj ) ) ;
55
55
a [ s . common . name ] = obj . val ;
56
56
}
57
57
if ( a . hasOwnProperty ( 'zone_list' ) && a . hasOwnProperty ( 'parallel' ) && a . hasOwnProperty ( 'enabled' ) && a . hasOwnProperty ( 'weather' ) ) {
@@ -60,11 +60,11 @@ class Programs {
60
60
this . proglist . push ( prog ) ;
61
61
gadapter . log . info ( `Program ${ prog . name } created` ) ;
62
62
} else {
63
- gadapter . log . error ( `Cannot create program ${ p . common . name } , because some values are missing` ) ;
63
+ gadapter . log . warn ( `Cannot create program ${ p . common . name } , because some values are missing` ) ;
64
64
}
65
65
}
66
66
} catch ( err ) {
67
- throw new Error ( `Cannot initialize programs: ${ err } ` ) ;
67
+ gadapter . log . error ( `Cannot initialize programs: ${ err } ` ) ;
68
68
}
69
69
}
70
70
@@ -75,6 +75,7 @@ class Programs {
75
75
}
76
76
}
77
77
78
+ /*
78
79
dumpAllProgs(str) {
79
80
for (let p of this.proglist) {
80
81
const az = p.allZones();
@@ -84,7 +85,7 @@ class Programs {
84
85
85
86
}
86
87
}
87
-
88
+ */
88
89
89
90
getProgram ( id ) {
90
91
const c = id . split ( '.' ) ;
@@ -94,13 +95,12 @@ class Programs {
94
95
return p ;
95
96
}
96
97
}
97
-
98
98
return null ;
99
99
}
100
100
101
101
async stateChange ( id , state ) {
102
102
const p = this . getProgram ( id ) ;
103
- this . adapter . log . info ( `State change (program) ${ id } (${ p . name } ), state: ` + JSON . stringify ( state ) ) ;
103
+ gadapter . log . info ( `State change (program) ${ id } (${ p . name } ), state: ` + JSON . stringify ( state ) ) ;
104
104
105
105
if ( ! p || ! state ) {
106
106
return ;
@@ -110,7 +110,7 @@ class Programs {
110
110
if ( ! p . isRunning ( ) ) this . startProgram ( p , true ) ;
111
111
} else {
112
112
if ( p . isRunning ( ) ) this . stopProgram ( p ) ;
113
- }
113
+ }
114
114
}
115
115
116
116
async zoneChange ( id , state ) {
@@ -176,22 +176,19 @@ class Programs {
176
176
// convert programs
177
177
let newcl = [ ] ;
178
178
// name, zone, duration, parallel, weather, enabled
179
- gadapter . log . info ( "=============== Creating config for programs ============" ) ;
179
+
180
180
for ( const p of conflist ) {
181
181
let np ;
182
182
if ( np = newcl . find ( x => x . name == p . name ) ) {
183
183
np . zone_list . push ( { name : p . zone , duration : p . duration } ) ;
184
184
} else {
185
185
newcl . push ( { name : p . name , zone_list : [ { name : p . zone , duration : p . duration } ] , parallel : p . parallel , weather : p . weather , enabled : p . enabled } ) ;
186
186
}
187
- gadapter . log . debug ( "convert conflist: p= " + JSON . stringify ( p ) ) ;
188
- gadapter . log . debug ( "convert conflist: newcl= " + JSON . stringify ( newcl ) ) ;
189
187
}
190
188
await config2object ( gadapter , newcl , device_name , statelist ) ;
191
189
}
192
190
193
191
static async create_program ( adapter , prog ) {
194
- gadapter . log . debug ( `ENTRY create_program() (${ this . name } )` ) ;
195
192
try {
196
193
const obj = await adapter . createChannelAsync ( device_name , prog . name ) ;
197
194
if ( obj != undefined ) {
@@ -222,9 +219,7 @@ class Programs {
222
219
} catch ( err ) {
223
220
adapter . log . error ( `Cannot create program ${ prog . name } , err: ${ err } ` ) ;
224
221
}
225
- gadapter . log . debug ( `EXIT create_program` ) ;
226
222
}
227
-
228
223
}
229
224
230
225
@@ -282,19 +277,18 @@ class Program {
282
277
}
283
278
284
279
async stop ( ) {
285
- gadapter . log . debug ( `ENTRY stop() (${ this . name } )` ) ;
286
280
if ( this . isRunning ( ) ) {
287
281
if ( this . isParallel ( ) ) {
288
282
const az = this . allZones ( ) ;
289
283
for ( const z of az ) {
290
- gadapter . log . debug ( `Program ${ this . name } stopped, stopping zone ${ z . name } ` ) ;
284
+ gadapter . log . info ( `Program ${ this . name } stopped, stopping zone ${ z . name } ` ) ;
291
285
z . zone . stop ( ) ;
292
286
z . running = false ;
293
287
}
294
288
} else {
295
289
const z = this . activeZone ( ) ;
296
290
if ( z ) {
297
- gadapter . log . debug ( `Program ${ this . name } stopped, stopping zone ${ z . name } ` ) ;
291
+ gadapter . log . info ( `Program ${ this . name } stopped, stopping zone ${ z . name } ` ) ;
298
292
z . zone . stop ( ) ;
299
293
z . running = false ;
300
294
}
@@ -338,7 +332,7 @@ class Program {
338
332
} else {
339
333
let act_zone = zl [ this . active - 1 ] ;
340
334
if ( act_zone . name != id ) {
341
- gadapter . log . info ( "nextZone called, but id (" + id + ") and act_zone (" + act_zone . name + ") are different, ignoring" ) ;
335
+ gadapter . log . debug ( "nextZone called, but id (" + id + ") and act_zone (" + act_zone . name + ") are different, ignoring" ) ;
342
336
return true ;
343
337
}
344
338
if ( ! act_zone . running ) {
0 commit comments