@@ -3325,7 +3325,8 @@ function Adapter(options) {
3325
3325
for ( var s = 0 ; s < that . autoSubscribe . length ; s ++ ) {
3326
3326
if ( pattern === '*' || pattern . substring ( 0 , that . autoSubscribe [ s ] . length + 1 ) === that . autoSubscribe [ s ] + '.' ) {
3327
3327
// put this pattern into adapter list
3328
- that . states . getForeignState ( 'system.adapter.' + that . autoSubscribe [ s ] + '.subscribes' , function ( err , state ) {
3328
+ that . states . getState ( 'system.adapter.' + that . autoSubscribe [ s ] + '.subscribes' , function ( err , state ) {
3329
+ state = { } ;
3329
3330
state . val = state . val || '{}' ;
3330
3331
var subs ;
3331
3332
try {
@@ -3336,7 +3337,7 @@ function Adapter(options) {
3336
3337
subs [ pattern ] = subs [ pattern ] || { } ;
3337
3338
subs [ pattern ] [ that . namespace ] = subs [ pattern ] [ that . namespace ] || 0 ;
3338
3339
subs [ pattern ] [ that . namespace ] ++ ;
3339
- that . states . setForeignState ( 'system.adapter.' + that . autoSubscribe [ s ] + '.subscribes' , subs ) ;
3340
+ that . states . setState ( 'system.adapter.' + that . autoSubscribe [ s ] + '.subscribes' , subs ) ;
3340
3341
} ) ;
3341
3342
}
3342
3343
}
@@ -3352,7 +3353,7 @@ function Adapter(options) {
3352
3353
for ( var s = 0 ; s < that . autoSubscribe . length ; s ++ ) {
3353
3354
if ( pattern === '*' || pattern . substring ( 0 , that . autoSubscribe [ s ] . length + 1 ) === that . autoSubscribe [ s ] + '.' ) {
3354
3355
// remove this pattern from adapter list
3355
- that . states . getForeignState ( 'system.adapter.' + that . autoSubscribe [ s ] + '.subscribes' , function ( err , state ) {
3356
+ that . states . getState ( 'system.adapter.' + that . autoSubscribe [ s ] + '.subscribes' , function ( err , state ) {
3356
3357
if ( ! state || ! state . val ) return ;
3357
3358
var subs ;
3358
3359
try {
@@ -3374,7 +3375,7 @@ function Adapter(options) {
3374
3375
}
3375
3376
}
3376
3377
if ( ! found ) delete subs [ pattern ] ;
3377
- that . states . setForeignState ( 'system.adapter.' + that . autoSubscribe [ s ] + '.subscribes' , subs ) ;
3378
+ that . states . setState ( 'system.adapter.' + that . autoSubscribe [ s ] + '.subscribes' , subs ) ;
3378
3379
} ) ;
3379
3380
}
3380
3381
}
0 commit comments