@@ -1412,23 +1412,25 @@ $(document).ready(function () {
14121412 break ;
14131413
14141414 case "homeassistant" :
1415- var token = conf_editor . getEditor ( "root.specificOptions.token" ) . getValue ( ) ;
1415+ const port = conf_editor . getEditor ( "root.specificOptions.port" ) . getValue ( ) ;
1416+ const useSsl = conf_editor . getEditor ( "root.specificOptions.useSsl" ) . getValue ( ) ;
1417+ const token = conf_editor . getEditor ( "root.specificOptions.token" ) . getValue ( ) ;
14161418 if ( token === "" ) {
14171419 return ;
14181420 }
14191421
1420- params = { host : host , token : token , filter : "states" } ;
1422+ params = { host, port , useSsl , token, filter : "states" } ;
14211423 getProperties_device ( ledType , host , params ) ;
14221424 break ;
14231425
14241426 case "nanoleaf" :
14251427 $ ( '#btn_wiz_holder' ) . show ( ) ;
14261428
1427- var token = conf_editor . getEditor ( "root.specificOptions.token" ) . getValue ( ) ;
1429+ token = conf_editor . getEditor ( "root.specificOptions.token" ) . getValue ( ) ;
14281430 if ( token === "" ) {
14291431 return ;
14301432 }
1431- params = { host : host , token : token } ;
1433+ params = { host, token } ;
14321434 getProperties_device ( ledType , host , params ) ;
14331435 break ;
14341436
@@ -1586,22 +1588,24 @@ $(document).ready(function () {
15861588 if ( token !== "" ) {
15871589 let params = { } ;
15881590
1589- var host = "" ;
1591+ let host = "" ;
15901592 switch ( ledType ) {
15911593 case "homeassistant" :
15921594 host = conf_editor . getEditor ( "root.specificOptions.host" ) . getValue ( ) ;
15931595 if ( host === "" ) {
15941596 return
15951597 }
1596- params = { host : host , token : token , filter : "states" } ;
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" } ;
15971601 break ;
15981602
15991603 case "nanoleaf" :
16001604 host = conf_editor . getEditor ( "root.specificOptions.host" ) . getValue ( ) ;
16011605 if ( host === "" ) {
16021606 return
16031607 }
1604- params = { host : host , token : token } ;
1608+ params = { host, token } ;
16051609 break ;
16061610 default :
16071611 }
@@ -1610,6 +1614,54 @@ $(document).ready(function () {
16101614 }
16111615 } ) ;
16121616
1617+ conf_editor . watch ( 'root.specificOptions.port' , ( ) => {
1618+
1619+ const port = conf_editor . getEditor ( "root.specificOptions.port" ) . getValue ( ) ;
1620+
1621+ if ( port !== "" ) {
1622+ let params = { } ;
1623+
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 ) ;
1636+
1637+ break ;
1638+ }
1639+ }
1640+ } ) ;
1641+
1642+ conf_editor . watch ( 'root.specificOptions.useSsl' , ( ) => {
1643+
1644+ const useSsl = conf_editor . getEditor ( "root.specificOptions.useSsl" ) . getValue ( ) ;
1645+
1646+ let params = { } ;
1647+
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 ) ;
1660+
1661+ break ;
1662+ }
1663+ } ) ;
1664+
16131665 //Yeelight
16141666 conf_editor . watch ( 'root.specificOptions.lights' , ( ) => {
16151667 //Disable General Options, as LED count will be resolved from number of lights configured
@@ -1788,36 +1840,46 @@ $(document).ready(function () {
17881840
17891841 // Identify/ Test LED-Device
17901842 $ ( "#btn_test_controller" ) . off ( ) . on ( "click" , function ( ) {
1791- var ledType = $ ( "#leddevices" ) . val ( ) ;
1843+ const ledType = $ ( "#leddevices" ) . val ( ) ;
17921844 let params = { } ;
17931845
17941846 switch ( ledType ) {
17951847 case "cololight" :
17961848 case "wled" :
1797- var host = conf_editor . getEditor ( "root.specificOptions.host" ) . getValue ( ) ;
1798- params = { host : host } ;
1849+ {
1850+ const host = conf_editor . getEditor ( "root.specificOptions.host" ) . getValue ( ) ;
1851+ params = { host : host } ;
1852+ }
17991853 break ;
18001854
18011855 case "homeassistant" :
1802- var host = conf_editor . getEditor ( "root.specificOptions.host" ) . getValue ( ) ;
1803- var token = conf_editor . getEditor ( "root.specificOptions.token" ) . getValue ( ) ;
1804- const entityIds = conf_editor . getEditor ( "root.specificOptions.entityIds" ) . getValue ( ) ;
1805- params = { host : host , token : token , entity_id : entityIds } ;
1856+ {
1857+ const host = conf_editor . getEditor ( "root.specificOptions.host" ) . getValue ( ) ;
1858+ const port = conf_editor . getEditor ( "root.specificOptions.port" ) . getValue ( ) ;
1859+ const useSsl = conf_editor . getEditor ( "root.specificOptions.useSsl" ) . getValue ( ) ;
1860+ const token = conf_editor . getEditor ( "root.specificOptions.token" ) . getValue ( ) ;
1861+ const entityIds = conf_editor . getEditor ( "root.specificOptions.entityIds" ) . getValue ( ) ;
1862+ params = { host, port, useSsl, token, entity_id : entityIds } ;
1863+ }
18061864 break ;
18071865
18081866 case "nanoleaf" :
1809- var host = conf_editor . getEditor ( "root.specificOptions.host" ) . getValue ( ) ;
1810- var token = conf_editor . getEditor ( "root.specificOptions.token" ) . getValue ( ) ;
1811- params = { host : host , token : token } ;
1867+ {
1868+ const host = conf_editor . getEditor ( "root.specificOptions.host" ) . getValue ( ) ;
1869+ const token = conf_editor . getEditor ( "root.specificOptions.token" ) . getValue ( ) ;
1870+ params = { host, token } ;
1871+ }
18121872 break ;
18131873
18141874 case "adalight" :
18151875 case "skydimo" :
1816- var currentLedCount = conf_editor . getEditor ( "root.generalOptions.hardwareLedCount" ) . getValue ( ) ;
1817- params = Object . assign ( conf_editor . getEditor ( "root.generalOptions" ) . getValue ( ) ,
1818- conf_editor . getEditor ( "root.specificOptions" ) . getValue ( ) ,
1819- { currentLedCount }
1820- ) ;
1876+ {
1877+ const currentLedCount = conf_editor . getEditor ( "root.generalOptions.hardwareLedCount" ) . getValue ( ) ;
1878+ params = Object . assign ( conf_editor . getEditor ( "root.generalOptions" ) . getValue ( ) ,
1879+ conf_editor . getEditor ( "root.specificOptions" ) . getValue ( ) ,
1880+ { currentLedCount }
1881+ ) ;
1882+ }
18211883 default :
18221884 }
18231885
@@ -2815,3 +2877,4 @@ function nanoleafGeneratelayout(panelLayout, panelOrderTopDown, panelOrderLeftRi
28152877 return layoutObjects ;
28162878}
28172879
2880+
0 commit comments