@@ -1412,6 +1412,7 @@ $(document).ready(function () {
14121412 break ;
14131413
14141414 case "homeassistant" :
1415+ {
14151416 const port = conf_editor . getEditor ( "root.specificOptions.port" ) . getValue ( ) ;
14161417 const useSsl = conf_editor . getEditor ( "root.specificOptions.useSsl" ) . getValue ( ) ;
14171418 const token = conf_editor . getEditor ( "root.specificOptions.token" ) . getValue ( ) ;
@@ -1421,17 +1422,20 @@ $(document).ready(function () {
14211422
14221423 params = { host, port, useSsl, token, filter : "states" } ;
14231424 getProperties_device ( ledType , host , params ) ;
1425+ }
14241426 break ;
14251427
14261428 case "nanoleaf" :
1427- $ ( '#btn_wiz_holder' ) . show ( ) ;
1429+ {
1430+ $ ( '#btn_wiz_holder' ) . show ( ) ;
14281431
1429- token = conf_editor . getEditor ( "root.specificOptions.token" ) . getValue ( ) ;
1430- if ( token === "" ) {
1431- return ;
1432+ const token = conf_editor . getEditor ( "root.specificOptions.token" ) . getValue ( ) ;
1433+ if ( token === "" ) {
1434+ return ;
1435+ }
1436+ params = { host, token } ;
1437+ getProperties_device ( ledType , host , params ) ;
14321438 }
1433- params = { host, token } ;
1434- getProperties_device ( ledType , host , params ) ;
14351439 break ;
14361440
14371441 case "wled" :
@@ -1591,21 +1595,25 @@ $(document).ready(function () {
15911595 let host = "" ;
15921596 switch ( ledType ) {
15931597 case "homeassistant" :
1594- host = conf_editor . getEditor ( "root.specificOptions.host" ) . getValue ( ) ;
1595- if ( host === "" ) {
1596- return
1598+ {
1599+ host = conf_editor . getEditor ( "root.specificOptions.host" ) . getValue ( ) ;
1600+ if ( host === "" ) {
1601+ return
1602+ }
1603+ const port = conf_editor . getEditor ( "root.specificOptions.port" ) . getValue ( ) ;
1604+ const useSsl = conf_editor . getEditor ( "root.specificOptions.useSsl" ) . getValue ( ) ;
1605+ params = { host, port, useSsl, token, filter : "states" } ;
15971606 }
1598- const port = conf_editor . getEditor ( "root.specificOptions.port" ) . getValue ( ) ;
1599- const useSsl = conf_editor . getEditor ( "root.specificOptions.useSsl" ) . getValue ( ) ;
1600- params = { host, port, useSsl, token, filter : "states" } ;
16011607 break ;
16021608
16031609 case "nanoleaf" :
1604- host = conf_editor . getEditor ( "root.specificOptions.host" ) . getValue ( ) ;
1605- if ( host === "" ) {
1606- return
1610+ {
1611+ host = conf_editor . getEditor ( "root.specificOptions.host" ) . getValue ( ) ;
1612+ if ( host === "" ) {
1613+ return
1614+ }
1615+ params = { host, token } ;
16071616 }
1608- params = { host, token } ;
16091617 break ;
16101618 default :
16111619 }
@@ -1617,48 +1625,38 @@ $(document).ready(function () {
16171625 conf_editor . watch ( 'root.specificOptions.port' , ( ) => {
16181626
16191627 const port = conf_editor . getEditor ( "root.specificOptions.port" ) . getValue ( ) ;
1620-
16211628 if ( port !== "" ) {
16221629 let params = { } ;
1630+ if ( ledType === "homeassistant" ) {
1631+ const host = conf_editor . getEditor ( "root.specificOptions.host" ) . getValue ( ) ;
1632+ const token = conf_editor . getEditor ( "root.specificOptions.token" ) . getValue ( ) ;
16231633
1624- switch ( ledType ) {
1625- case "homeassistant" :
1626- const host = conf_editor . getEditor ( "root.specificOptions.host" ) . getValue ( ) ;
1627- const token = conf_editor . getEditor ( "root.specificOptions.token" ) . getValue ( ) ;
1628-
1629- if ( host === "" || token == "" ) {
1630- return
1631- }
1632- const useSsl = conf_editor . getEditor ( "root.specificOptions.useSsl" ) . getValue ( ) ;
1633- params = { host, port, useSsl, token, filter : "states" } ;
1634-
1635- getProperties_device ( ledType , host , params ) ;
1634+ if ( host === "" || token == "" ) {
1635+ return
1636+ }
1637+ const useSsl = conf_editor . getEditor ( "root.specificOptions.useSsl" ) . getValue ( ) ;
1638+ params = { host, port, useSsl, token, filter : "states" } ;
16361639
1637- break ;
1640+ getProperties_device ( ledType , host , params ) ;
16381641 }
16391642 }
16401643 } ) ;
16411644
16421645 conf_editor . watch ( 'root.specificOptions.useSsl' , ( ) => {
16431646
1644- const useSsl = conf_editor . getEditor ( "root.specificOptions.useSsl" ) . getValue ( ) ;
1645-
16461647 let params = { } ;
1648+ if ( ledType === "homeassistant" ) {
1649+ const host = conf_editor . getEditor ( "root.specificOptions.host" ) . getValue ( ) ;
1650+ const token = conf_editor . getEditor ( "root.specificOptions.token" ) . getValue ( ) ;
16471651
1648- switch ( ledType ) {
1649- case "homeassistant" :
1650- const host = conf_editor . getEditor ( "root.specificOptions.host" ) . getValue ( ) ;
1651- const token = conf_editor . getEditor ( "root.specificOptions.token" ) . getValue ( ) ;
1652-
1653- if ( host === "" || token == "" ) {
1654- return
1655- }
1656- const port = conf_editor . getEditor ( "root.specificOptions.port" ) . getValue ( ) ;
1657- params = { host, port, useSsl, token, filter : "states" } ;
1658-
1659- getProperties_device ( ledType , host , params ) ;
1652+ if ( host === "" || token == "" ) {
1653+ return
1654+ }
1655+ const port = conf_editor . getEditor ( "root.specificOptions.port" ) . getValue ( ) ;
1656+ const useSsl = conf_editor . getEditor ( "root.specificOptions.useSsl" ) . getValue ( ) ;
1657+ params = { host, port, useSsl, token, filter : "states" } ;
16601658
1661- break ;
1659+ getProperties_device ( ledType , host , params ) ;
16621660 }
16631661 } ) ;
16641662
@@ -2876,5 +2874,3 @@ function nanoleafGeneratelayout(panelLayout, panelOrderTopDown, panelOrderLeftRi
28762874 } ) ;
28772875 return layoutObjects ;
28782876}
2879-
2880-
0 commit comments