@@ -55,9 +55,9 @@ function calculateSunTimes() {
5555 const yesterday = new Date ( today . getTime ( ) - 86400000 ) ; // (24 * 60 * 60 * 1000));
5656 const tomorrow = new Date ( today . getTime ( ) + 86400000 ) ; // (24 * 60 * 60 * 1000));
5757 sunTimes = [
58- suncalc . getTimes ( yesterday , config . l , config . m ) ,
59- suncalc . getTimes ( today , config . l , config . m ) ,
60- suncalc . getTimes ( tomorrow , config . l , config . m )
58+ suncalc . getTimes ( yesterday , config . latitude , config . longitude ) ,
59+ suncalc . getTimes ( today , config . latitude , config . longitude ) ,
60+ suncalc . getTimes ( tomorrow , config . latitude , config . longitude )
6161 ] ;
6262}
6363
@@ -187,7 +187,7 @@ mqtt.on('message', (topic, payload, msg) => {
187187 const topicArr = topic . split ( '/' ) ;
188188 let oldState ;
189189
190- if ( topicArr [ 0 ] === config . s && topicArr [ 1 ] === 'set' && ! config . t ) {
190+ if ( topicArr [ 0 ] === config . variablePrefix && topicArr [ 1 ] === 'set' && ! config . disableVariables ) {
191191 topicArr [ 1 ] = 'status' ;
192192 topic = topicArr . join ( '/' ) ;
193193 oldState = status [ topic ] || { } ;
@@ -415,7 +415,7 @@ function runScript(script, name) {
415415 }
416416
417417 if ( typeof topic === 'string' ) {
418- topic = topic . replace ( / ^ \$ / , config . s + '/status/' ) ;
418+ topic = topic . replace ( / ^ \$ / , config . variablePrefix + '/status/' ) ;
419419 topic = topic . replace ( / ^ ( [ ^ / ] + ) \/ \/ / , '$1/status/' ) ;
420420
421421 if ( typeof options . condition === 'string' ) {
@@ -606,10 +606,10 @@ function runScript(script, name) {
606606
607607 let changed ;
608608
609- topic = topic . replace ( / ^ \$ / , config . s + '//' ) ;
609+ topic = topic . replace ( / ^ \$ / , config . variablePrefix + '//' ) ;
610610
611611 const tmp = topic . split ( '/' ) ;
612- if ( tmp [ 0 ] === config . s && ! config . t ) {
612+ if ( tmp [ 0 ] === config . variablePrefix && ! config . disableVariables ) {
613613 // Variable
614614
615615 tmp [ 1 ] = 'status' ;
@@ -631,7 +631,7 @@ function runScript(script, name) {
631631 Sandbox . publish ( topic , val , { retain : true } ) ;
632632 }
633633 /* istanbul ignore next */ // TODO tests!
634- } else if ( tmp [ 0 ] === config . s && config . t ) {
634+ } else if ( tmp [ 0 ] === config . variablePrefix && config . disableVariables ) {
635635 /* istanbul ignore next */
636636 tmp [ 1 ] = 'status' ;
637637 topic = tmp . join ( '/' ) ;
@@ -653,7 +653,7 @@ function runScript(script, name) {
653653 * @returns {mixed } the topics value
654654 */
655655 getValue : function Sandbox_getValue ( topic ) {
656- topic = topic . replace ( / ^ \$ / , config . s + '/status/' ) ;
656+ topic = topic . replace ( / ^ \$ / , config . variablePrefix + '/status/' ) ;
657657 topic = topic . replace ( / ^ ( [ ^ / ] + ) \/ \/ ( .+ ) $ / , '$1/status/$2' ) ;
658658 return status [ topic ] && status [ topic ] . val ;
659659 } ,
@@ -781,7 +781,7 @@ function loadSandbox(callback) {
781781 }
782782 } ) ;
783783
784- if ( ! config [ 'disable-watch' ] ) {
784+ if ( ! config . disableWatch ) {
785785 watch . watchTree ( dir , {
786786 filter ( path ) {
787787 return path . match ( / \. j s $ / ) ;
@@ -818,7 +818,7 @@ function loadDir(dir) {
818818 }
819819 } ) ;
820820
821- if ( ! config [ 'disable-watch' ] ) {
821+ if ( ! config . disableWatch ) {
822822 watch . watchTree ( dir , {
823823 filter ( path ) {
824824 return path . match ( / \. ( j s | c o f f e e ) $ / ) ;
0 commit comments