@@ -3325,7 +3325,8 @@ function Adapter(options) {
33253325 for ( var s = 0 ; s < that . autoSubscribe . length ; s ++ ) {
33263326 if ( pattern === '*' || pattern . substring ( 0 , that . autoSubscribe [ s ] . length + 1 ) === that . autoSubscribe [ s ] + '.' ) {
33273327 // 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 = { } ;
33293330 state . val = state . val || '{}' ;
33303331 var subs ;
33313332 try {
@@ -3336,7 +3337,7 @@ function Adapter(options) {
33363337 subs [ pattern ] = subs [ pattern ] || { } ;
33373338 subs [ pattern ] [ that . namespace ] = subs [ pattern ] [ that . namespace ] || 0 ;
33383339 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 ) ;
33403341 } ) ;
33413342 }
33423343 }
@@ -3352,7 +3353,7 @@ function Adapter(options) {
33523353 for ( var s = 0 ; s < that . autoSubscribe . length ; s ++ ) {
33533354 if ( pattern === '*' || pattern . substring ( 0 , that . autoSubscribe [ s ] . length + 1 ) === that . autoSubscribe [ s ] + '.' ) {
33543355 // 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 ) {
33563357 if ( ! state || ! state . val ) return ;
33573358 var subs ;
33583359 try {
@@ -3374,7 +3375,7 @@ function Adapter(options) {
33743375 }
33753376 }
33763377 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 ) ;
33783379 } ) ;
33793380 }
33803381 }
0 commit comments