Files
Scanning the repository...
Last update 4 years 11 months
by rohit.kumar@avl.com
FilesHASwitchPlatecontribopenHAB | |
---|---|
.. | |
HASP-Foyer.items | |
HASP-Foyer.rules | |
HASP-Master.items | |
HASP-Master.rules | |
HASP.sitemap | |
README.md |
HASP-Master.rules/* -------------------------------------- BEGIN USER CONFIG -------------------------------------- */ /* Configuration for the three page selection buttons at the bottom of the page */ val plate01_pagebutton1page = 1 // Set page # for bottom left button val plate01_pagebutton1txt = 'Scenes' // Set page title for bottom left button val plate01_pagebutton2page = 2 // Set page # for bottom center button val plate01_pagebutton2txt = 'Status' // Set page title for bottom left button val plate01_pagebutton3page = 6 // Set page # for bottom right button val plate01_pagebutton3txt = 'HVAC' // Set page title for bottom left button /* Configuration for page 1 (Scenes) */ val plate01_page1button4txt = 'Morning' val plate01_page1button5txt = 'Evening' val plate01_page1button6txt = 'Night' val plate01_page1button7txt = 'Bedtime' val plate01_page1button4font = 2 val plate01_page1button5font = 2 val plate01_page1button6font = 2 val plate01_page1button7font = 2 /* Configuration for page 2 (Status) */ val plate01_page2button4txt = 'Line 1' val plate01_page2button5txt = 'Line 2' val plate01_page2button6txt = 'Line 3' val plate01_page2button7txt = 'Line 4' val plate01_page2button4font = 2 val plate01_page2button5font = 2 val plate01_page2button6font = 2 val plate01_page2button7font = 1 /* Configuration for page 3 (Page 3) */ val plate01_page3button4txt = 'P3 B4 Text' val plate01_page3button5txt = 'P3 B5 Text' val plate01_page3button6txt = 'P3 B6 Text' val plate01_page3button7txt = 'P3 B7 Text' val plate01_page3button4font = 1 val plate01_page3button5font = 1 val plate01_page3button6font = 1 val plate01_page3button7font = 1 /* Configuration for page 4 (Page 4) */ val plate01_page4button4txt = 'P4 B4 Light' val plate01_page4button5txt = 'P4 B5 Light' val plate01_page4button6txt = 'P4 B6 Light' val plate01_page4button4font = 1 val plate01_page4button5font = 1 val plate01_page4button6font = 1 /* Configuration for page 5 (Page 5) */ val plate01_page5button4txt = 'P5 B4 Light' val plate01_page5button5txt = 'P5 B5 Light' val plate01_page5button6txt = 'P5 B6 Light' val plate01_page5button4font = 1 val plate01_page5button5font = 1 val plate01_page5button6font = 1 /* Configuration for page 6 (HVAC) */ val plate01_page6button4txt = 'P6 B4' val plate01_page6button5txt = 'P6 B5' val plate01_page6button6txt = 'P6 B6' val plate01_page6button7txt = 'P6 B7' val plate01_page6button8txt = 'P6 B8' val plate01_page6button9txt = 'P6 B9' val plate01_page6button10txt = 'P6 B10' val plate01_page6button11txt = 'P6 B11' val plate01_page6button4font = 1 val plate01_page6button5font = 1 val plate01_page6button6font = 1 val plate01_page6button7font = 1 val plate01_page6button8font = 1 val plate01_page6button9font = 1 val plate01_page6button10font = 1 val plate01_page6button11font = 1 /* Configuration for page 7 (Page 7) */ val plate01_page7button4txt = '1' val plate01_page7button5txt = '2' val plate01_page7button6txt = '3' val plate01_page7button7txt = '4' val plate01_page7button8txt = '5' val plate01_page7button9txt = '6' val plate01_page7button10txt = '7' val plate01_page7button11txt = '8' val plate01_page7button12txt = '9' val plate01_page7button13txt = '*' val plate01_page7button14txt = '0' val plate01_page7button15txt = '#' val plate01_page7button4font = 3 val plate01_page7button5font = 3 val plate01_page7button6font = 3 val plate01_page7button7font = 3 val plate01_page7button8font = 3 val plate01_page7button9font = 3 val plate01_page7button10font = 3 val plate01_page7button11font = 3 val plate01_page7button12font = 3 val plate01_page7button13font = 3 val plate01_page7button14font = 3 val plate01_page7button15font = 3 /* Configuration for page 8 (Page 8) */ val plate01_page8button4txt = 'P8 B4' val plate01_page8button5txt = 'P8 B5' val plate01_page8button6txt = 'P8B6' val plate01_page8button7txt = 'P8B7' val plate01_page8button8txt = 'P8B8' val plate01_page8button4font = 1 val plate01_page8button5font = 1 val plate01_page8button6font = 1 val plate01_page8button7font = 1 val plate01_page8button8font = 1 /* Configuration for page 9 (Page 9) */ val plate01_page9button4txt = 'P9 B4' val plate01_page9button5txt = 'P9 B5' val plate01_page9button4font = 2 val plate01_page9button5font = 2 /* -------------------------------------- END USER CONFIG -------------------------------------- */ /* -------------------------------------- BEGIN USER-DEFINED HANDLER RULES -------------------------------------- */ // HASP -> openHAB item handling rules /* Use the rules below to add automation logic in your system, based on inputs from the HASP. There is an if statement for every button and dimmer on the HASP pages, and you just need to add your setup's items to the proper if statement, to use that button to control the item. Several examples are included (commented out) to get you started, whether you just want to send an ON command when the button is pressed, or toggle the output item depending on its current state. */ rule "Handle HASP Master" when Item HASP_Plate01_Plate_State_JSON_Value received update then //parse out data from JSON string (page, button, value) var String eventpage = HASP_Plate01_Plate_State_JSON_Event.state.toString.split("\\[").get(1).split("\\]").get(0) var String eventbutton = HASP_Plate01_Plate_State_JSON_Event.state.toString.split("\\[").get(2).split("\\]").get(0) if (HASP_Plate01_Plate_State_JSON_Value.state == 'OFF') { //Do nothing (button release event) logInfo ("HASP", "Ignoring OFF event") } else { //Handle Page/button/dimmer value event if(HASP_Plate01_Light_Power.state == OFF) { HASP_Plate01_Light_Power.sendCommand(ON) } else { if ((eventbutton == '1' || eventbutton == '2' || eventbutton == '3') && eventpage != '0') //Handle the pressing of one of the 3 bottom page buttons { switch(eventbutton) { case '1': { HASP_Plate01_Page.sendCommand(plate01_pagebutton1page as Number) } case '2': { HASP_Plate01_Page.sendCommand(plate01_pagebutton2page as Number) } case '3': { HASP_Plate01_Page.sendCommand(plate01_pagebutton3page as Number) } } HASP_Plate01_Light_Power.sendCommand(ON) //refresh backlight timer following button press } else { switch(eventpage) { case '0': { /* Act on buttons from Page 0 here */ if (eventbutton == '1') { //Insert action to perform if button 0 was pressed HASP_Plate01_Page.sendCommand(2 as Number) //This is only for when the HASP starts in page 0 and you need to go to a different page, this will send it to Page 2 } } case '1': { /* Act on buttons from Page 1 here */ if (eventbutton == '4') { //Insert action to perform if button 4 was pressed Scene_Morning.sendCommand(ON) //Example - Latching ON - send ON command from HASP button to turn item on } else if (eventbutton == '5') { //Insert action to perform if button 5 was pressed // if(Scene_Evening == ON) //Example - Toggle - change item state using HASP button (turn OFF if ON and ON if OFF) // { // Scene_Evening.sendCommand(OFF) // } // else // { // Scene_Evening.sendCommand(ON) // } Scene_Evening.sendCommand(ON) } else if (eventbutton == '6') { //Insert action to perform if button 6 was pressed Scene_Night.sendCommand(ON) } else if (eventbutton == '7') { //Insert action to perform if button 7 was pressed Scene_Bedtime.sendCommand(ON) } HASP_Plate01_Light_Power.sendCommand(ON) //refresh backlight timer following button press } case '2': { /* Act on buttons from Page 2 here */ if (eventbutton == '4') { //Insert action to perform if button 4 was pressed } else if (eventbutton == '5') { //Insert action to perform if button 5 was pressed } else if (eventbutton == '6') { //Insert action to perform if button 6 was pressed } else if (eventbutton == '7') { //Insert action to perform if button 7 was pressed } HASP_Plate01_Light_Power.sendCommand(ON) //refresh backlight timer following button press } case '3': { /* Act on buttons from Page 3 here */ if (eventbutton == '4') { //Insert action to perform if button 4 was pressed } else if (eventbutton == '5') { //Insert action to perform if button 5 was pressed } else if (eventbutton == '6') { //Insert action to perform if button 6 was pressed } else if (eventbutton == '7') { //Insert action to perform if button 7 was pressed } HASP_Plate01_Light_Power.sendCommand(ON) //refresh backlight timer following button press } case '4': { /* Act on buttons/dimmers from Page 4 here */ if (eventbutton == '4') { //Insert action to perform if button 4 was pressed } else if (eventbutton == '5') { //Insert action to perform if button 5 was pressed } else if (eventbutton == '6') { //Insert action to perform if button 6 was pressed } else if (eventbutton == '7') { //Insert action to perform if dimmer 1 was moved } else if (eventbutton == '8') { //Insert action to perform if dimmer 2 was moved } else if (eventbutton == '9') { //Insert action to perform if dimmer 3 was moved } HASP_Plate01_Light_Power.sendCommand(ON) //refresh backlight timer following button press } case '5': { /* Act on buttons/dimmers from Page 5 here */ if (eventbutton == '4') { //Insert action to perform if button 4 was pressed } else if (eventbutton == '5') { //Insert action to perform if button 5 was pressed } else if (eventbutton == '6') { //Insert action to perform if button 6 was pressed } else if (eventbutton == '7') { //Insert action to perform if dimmer 1 was moved if (HASP_Plate01_Plate_State_JSON_Value.state != 'ON'){ HASP_Plate01_Light_Dimmer.sendCommand(HASP_Plate01_Plate_State_JSON_Value.state.toString) //Example - send dimmer value to HASP Backlight item } } else if (eventbutton == '8') { //Insert action to perform if dimmer 2 was moved } else if (eventbutton == '9') { //Insert action to perform if dimmer 3 was moved } HASP_Plate01_Light_Power.sendCommand(ON) //refresh backlight timer following button press } case '6': { /* Act on buttons/dimmers from Page 6 here */ if (eventbutton == '4') { //Insert action to perform if button 4 was pressed } else if (eventbutton == '5') { //Insert action to perform if button 5 was pressed } else if (eventbutton == '6') { //Insert action to perform if button 6 was pressed } else if (eventbutton == '7') { //Insert action to perform if button 7 was moved } else if (eventbutton == '8') { //Insert action to perform if button 8 was moved } else if (eventbutton == '9') { //Insert action to perform if button 9 was moved } else if (eventbutton == '10') { //Insert action to perform if button 10 was moved } else if (eventbutton == '11') { //Insert action to perform if button 11 was moved } HASP_Plate01_Light_Power.sendCommand(ON) //refresh backlight timer following button press } case '7': { /* Act on buttons/dimmers from Page 7 here */ if (eventbutton == '4') { //Insert action to perform if button 4 was pressed } else if (eventbutton == '5') { //Insert action to perform if button 5 was pressed } else if (eventbutton == '6') { //Insert action to perform if button 6 was pressed } else if (eventbutton == '7') { //Insert action to perform if button 7 was moved } else if (eventbutton == '8') { //Insert action to perform if button 8 was moved } else if (eventbutton == '9') { //Insert action to perform if button 9 was moved } else if (eventbutton == '10') { //Insert action to perform if button 10 was moved } else if (eventbutton == '11') { //Insert action to perform if button 11 was moved } else if (eventbutton == '12') { //Insert action to perform if button 12 was moved } else if (eventbutton == '13') { //Insert action to perform if button 13 was moved } else if (eventbutton == '14') { //Insert action to perform if button 14 was moved } else if (eventbutton == '15') { //Insert action to perform if button 15 was moved } HASP_Plate01_Light_Power.sendCommand(ON) //refresh backlight timer following button press } case '8': { /* Act on buttons/dimmers from Page 8 here */ if (eventbutton == '4') { //Insert action to perform if button 4 was pressed } else if (eventbutton == '5') { //Insert action to perform if button 5 was pressed } else if (eventbutton == '6') { //Insert action to perform if button 6 was pressed } else if (eventbutton == '7') { //Insert action to perform if button 7 was moved } else if (eventbutton == '8') { //Insert action to perform if button 8 was moved } else if (eventbutton == '9') { //Insert action to perform if dimmer 9 was moved } HASP_Plate01_Light_Power.sendCommand(ON) //refresh backlight timer following button press } case '9': { /* Act on buttons/dimmers from Page 9 here */ if (eventbutton == '4') { //Insert action to perform if button 4 was pressed } else if (eventbutton == '5') { //Insert action to perform if button 5 was pressed } HASP_Plate01_Light_Power.sendCommand(ON) //refresh backlight timer following button press } } } } } end // openHAB -> HASP item handling rules /* Use the rules below to modify the HASP display based on inputs from your openHAB system. A sample rule has been included to show you how to modify a dimmer value on Page 5, to make it match the actual position of the openHAB item (in this case, we're simply taking the input from Dimmer 1, which is tied to the HASP Backlight item in the HASP -> openHAB rules above, and sending that value to Dimmer 2) You can also use these rules to display status information on one of the screens of the HASP (i.e. weather, system status, clock, etc..) Another great use for these rules would be for screen 9, which is built to show 3d printer status from Octoprint. */ rule "Handle HASP Master Page 2 Status" when Item localCurrentTemperature received update or Item Temperature_MasterBedroom received update or Item Date received update or Item HASP_Plate01_Page_Current received update 2 then if (HASP_Plate01_Page_Current.state == 2) //Only update page if you're on page 2 (avoid sending too many MQTT messages) { //["p[2].b[4].txt=\"O: 27.6 °F\"", "p[2].b[5].txt=\"I: 71.8 °F\"", ...] var jsonString = '["p[2].b[4].txt=\\"' + 'O: ' + localCurrentTemperature.state.format("%.1f °F") + '\\"", ' + '"p[2].b[5].txt=\\"' + 'I: ' + Temperature_MasterBedroom.state.format("%.1f °F") + '\\"", ' + '"p[2].b[6].txt=\\"' + (Date.state as DateTimeType).format("%1$tA") + '\\"", ' + '"p[2].b[7].txt=\\"' + (Date.state as DateTimeType).format("%1$td.%1$tb.%1$tY") + '\\""]' HASP_Plate01_Plate_Command_JSON.sendCommand(jsonString) } end rule "Handle HASP Master Page 5 dimmers" when Item HASP_Plate01_Light_Brightness received update then var jsonString = '["p[5].b[8].val=' + HASP_Plate01_Light_Brightness.state + '"]' HASP_Plate01_Plate_Command_JSON.sendCommand(jsonString) end rule "Handle HASP Master Page 9 chart" when Time cron "0 * * ? * *" //Fire rule every minute then if (HASP_Plate01_Page_Current.state == 9) //Only update chart if you're on page 9 (chart gets reset when page is not active) { var Number sigStrength = (((HASP_Plate01_Plate_Sensor_SignalStrength.state as DecimalType) + 100 ) * 1.333).intValue logInfo("HASP", sigStrength.toString) HASP_Plate01_Plate_Command.sendCommand('add 6,0,' + sigStrength.toString) } end /* -------------------------------------- END USER-DEFINED HANDLER RULES -------------------------------------- */ /* Restore saved page and rebuild config on reconnect */ rule "HASP Master Restore page on connect" when Item HASP_Plate01_Plate_Status changed to "ON" or Item HASP_Plate01_Plate_Refresh received command ON then HASP_Plate01_Page.sendCommand(HASP_Plate01_Page_Current.state as Number) // Send HASP to previous page var jsonString = '["p[1].b[1].bco=25388", ' + //Initialize bottom page buttons with gray color '"p[1].b[2].bco=25388", ' + '"p[1].b[3].bco=25388", ' + '"p[2].b[1].bco=25388", ' + '"p[2].b[2].bco=25388", ' + '"p[2].b[3].bco=25388", ' + '"p[3].b[1].bco=25388", ' + '"p[3].b[2].bco=25388", ' + '"p[3].b[3].bco=25388", ' + '"p[4].b[1].bco=25388", ' + '"p[4].b[2].bco=25388", ' + '"p[4].b[3].bco=25388", ' + '"p[5].b[1].bco=25388", ' + '"p[5].b[2].bco=25388", ' + '"p[5].b[3].bco=25388", ' + '"p[6].b[1].bco=25388", ' + '"p[6].b[2].bco=25388", ' + '"p[6].b[3].bco=25388", ' + '"p[7].b[1].bco=25388", ' + '"p[7].b[2].bco=25388", ' + '"p[7].b[3].bco=25388", ' + '"p[8].b[1].bco=25388", ' + '"p[8].b[2].bco=25388", ' + '"p[8].b[3].bco=25388", ' + '"p[9].b[1].bco=25388", ' + '"p[9].b[2].bco=25388", ' + '"p[9].b[3].bco=25388", ' + '"p[1].b[1].txt=\\"' + plate01_pagebutton1txt + '\\"", ' + //Initialize bottom page button text '"p[1].b[2].txt=\\"' + plate01_pagebutton2txt + '\\"", ' + '"p[1].b[3].txt=\\"' + plate01_pagebutton3txt + '\\"", ' + '"p[2].b[1].txt=\\"' + plate01_pagebutton1txt + '\\"", ' + '"p[2].b[2].txt=\\"' + plate01_pagebutton2txt + '\\"", ' + '"p[2].b[3].txt=\\"' + plate01_pagebutton3txt + '\\"", ' + '"p[3].b[1].txt=\\"' + plate01_pagebutton1txt + '\\"", ' + '"p[3].b[2].txt=\\"' + plate01_pagebutton2txt + '\\"", ' + '"p[3].b[3].txt=\\"' + plate01_pagebutton3txt + '\\"", ' + '"p[4].b[1].txt=\\"' + plate01_pagebutton1txt + '\\"", ' + '"p[4].b[2].txt=\\"' + plate01_pagebutton2txt + '\\"", ' + '"p[4].b[3].txt=\\"' + plate01_pagebutton3txt + '\\"", ' + '"p[5].b[1].txt=\\"' + plate01_pagebutton1txt + '\\"", ' + '"p[5].b[2].txt=\\"' + plate01_pagebutton2txt + '\\"", ' + '"p[5].b[3].txt=\\"' + plate01_pagebutton3txt + '\\"", ' + '"p[6].b[1].txt=\\"' + plate01_pagebutton1txt + '\\"", ' + '"p[6].b[2].txt=\\"' + plate01_pagebutton2txt + '\\"", ' + '"p[6].b[3].txt=\\"' + plate01_pagebutton3txt + '\\"", ' + '"p[7].b[1].txt=\\"' + plate01_pagebutton1txt + '\\"", ' + '"p[7].b[2].txt=\\"' + plate01_pagebutton2txt + '\\"", ' + '"p[7].b[3].txt=\\"' + plate01_pagebutton3txt + '\\"", ' + '"p[8].b[1].txt=\\"' + plate01_pagebutton1txt + '\\"", ' + '"p[8].b[2].txt=\\"' + plate01_pagebutton2txt + '\\"", ' + '"p[8].b[3].txt=\\"' + plate01_pagebutton3txt + '\\"", ' + '"p[9].b[1].txt=\\"' + plate01_pagebutton1txt + '\\"", ' + '"p[9].b[2].txt=\\"' + plate01_pagebutton2txt + '\\"", ' + '"p[9].b[3].txt=\\"' + plate01_pagebutton3txt + '\\""]' HASP_Plate01_Plate_Command_JSON.sendCommand(jsonString) jsonString = '["p[1].b[4].txt=\\"' + plate01_page1button4txt + '\\"", ' + // Update button texts for all pages '"p[1].b[5].txt=\\"' + plate01_page1button5txt + '\\"", ' + '"p[1].b[6].txt=\\"' + plate01_page1button6txt + '\\"", ' + '"p[1].b[7].txt=\\"' + plate01_page1button7txt + '\\"", ' + '"p[2].b[4].txt=\\"' + plate01_page2button4txt + '\\"", ' + '"p[2].b[5].txt=\\"' + plate01_page2button5txt + '\\"", ' + '"p[2].b[6].txt=\\"' + plate01_page2button6txt + '\\"", ' + '"p[2].b[7].txt=\\"' + plate01_page2button7txt + '\\"", ' + '"p[3].b[4].txt=\\"' + plate01_page3button4txt + '\\"", ' + '"p[3].b[5].txt=\\"' + plate01_page3button5txt + '\\"", ' + '"p[3].b[6].txt=\\"' + plate01_page3button6txt + '\\"", ' + '"p[3].b[7].txt=\\"' + plate01_page3button7txt + '\\"", ' + '"p[4].b[4].txt=\\"' + plate01_page4button4txt + '\\"", ' + '"p[4].b[5].txt=\\"' + plate01_page4button5txt + '\\"", ' + '"p[4].b[6].txt=\\"' + plate01_page4button6txt + '\\"", ' + '"p[5].b[4].txt=\\"' + plate01_page5button4txt + '\\"", ' + '"p[5].b[5].txt=\\"' + plate01_page5button5txt + '\\"", ' + '"p[5].b[6].txt=\\"' + plate01_page5button6txt + '\\"", ' + '"p[6].b[4].txt=\\"' + plate01_page6button4txt + '\\"", ' + '"p[6].b[5].txt=\\"' + plate01_page6button5txt + '\\"", ' + '"p[6].b[6].txt=\\"' + plate01_page6button6txt + '\\"", ' + '"p[6].b[7].txt=\\"' + plate01_page6button7txt + '\\"", ' + '"p[6].b[8].txt=\\"' + plate01_page6button8txt + '\\"", ' + '"p[6].b[9].txt=\\"' + plate01_page6button9txt + '\\"", ' + '"p[6].b[10].txt=\\"' + plate01_page6button10txt + '\\"", ' + '"p[6].b[11].txt=\\"' + plate01_page6button11txt + '\\"", ' + '"p[7].b[4].txt=\\"' + plate01_page7button4txt + '\\"", ' + '"p[7].b[5].txt=\\"' + plate01_page7button5txt + '\\"", ' + '"p[7].b[6].txt=\\"' + plate01_page7button6txt + '\\"", ' + '"p[7].b[7].txt=\\"' + plate01_page7button7txt + '\\"", ' + '"p[7].b[8].txt=\\"' + plate01_page7button8txt + '\\"", ' + '"p[7].b[9].txt=\\"' + plate01_page7button9txt + '\\"", ' + '"p[7].b[10].txt=\\"' + plate01_page7button10txt + '\\"", ' + '"p[7].b[11].txt=\\"' + plate01_page7button11txt + '\\"", ' + '"p[7].b[12].txt=\\"' + plate01_page7button12txt + '\\"", ' + '"p[7].b[13].txt=\\"' + plate01_page7button13txt + '\\"", ' + '"p[7].b[14].txt=\\"' + plate01_page7button14txt + '\\"", ' + '"p[7].b[15].txt=\\"' + plate01_page7button15txt + '\\"", ' + '"p[8].b[4].txt=\\"' + plate01_page8button4txt + '\\"", ' + '"p[8].b[5].txt=\\"' + plate01_page8button5txt + '\\"", ' + '"p[8].b[6].txt=\\"' + plate01_page8button6txt + '\\"", ' + '"p[8].b[7].txt=\\"' + plate01_page8button7txt + '\\"", ' + '"p[8].b[8].txt=\\"' + plate01_page8button8txt + '\\"", ' + '"p[9].b[4].txt=\\"' + plate01_page9button4txt + '\\"", ' + '"p[9].b[5].txt=\\"' + plate01_page9button5txt + '\\""]' HASP_Plate01_Plate_Command_JSON.sendCommand(jsonString) jsonString = '["p[1].b[4].font=' + plate01_page1button4font + '", ' + // Update font sizes for all pages '"p[1].b[5].font=' + plate01_page1button5font + '", ' + '"p[1].b[6].font=' + plate01_page1button6font + '", ' + '"p[1].b[7].font=' + plate01_page1button7font + '", ' + '"p[2].b[4].font=' + plate01_page2button4font + '", ' + '"p[2].b[5].font=' + plate01_page2button5font + '", ' + '"p[2].b[6].font=' + plate01_page2button6font + '", ' + '"p[2].b[7].font=' + plate01_page2button7font + '", ' + '"p[3].b[4].font=' + plate01_page3button4font + '", ' + '"p[3].b[5].font=' + plate01_page3button5font + '", ' + '"p[3].b[6].font=' + plate01_page3button6font + '", ' + '"p[3].b[7].font=' + plate01_page3button7font + '", ' + '"p[4].b[4].font=' + plate01_page4button4font + '", ' + '"p[4].b[5].font=' + plate01_page4button5font + '", ' + '"p[4].b[6].font=' + plate01_page4button6font + '", ' + '"p[5].b[4].font=' + plate01_page5button4font + '", ' + '"p[5].b[5].font=' + plate01_page5button5font + '", ' + '"p[5].b[6].font=' + plate01_page5button6font + '", ' + '"p[6].b[4].font=' + plate01_page6button4font + '", ' + '"p[6].b[5].font=' + plate01_page6button5font + '", ' + '"p[6].b[6].font=' + plate01_page6button6font + '", ' + '"p[6].b[7].font=' + plate01_page6button7font + '", ' + '"p[6].b[8].font=' + plate01_page6button8font + '", ' + '"p[6].b[9].font=' + plate01_page6button9font + '", ' + '"p[6].b[10].font=' + plate01_page6button10font + '", ' + '"p[6].b[11].font=' + plate01_page6button11font + '", ' + '"p[7].b[4].font=' + plate01_page7button4font + '", ' + '"p[7].b[5].font=' + plate01_page7button5font + '", ' + '"p[7].b[6].font=' + plate01_page7button6font + '", ' + '"p[7].b[7].font=' + plate01_page7button7font + '", ' + '"p[7].b[8].font=' + plate01_page7button8font + '", ' + '"p[7].b[9].font=' + plate01_page7button9font + '", ' + '"p[7].b[10].font=' + plate01_page7button10font + '", ' + '"p[7].b[11].font=' + plate01_page7button11font + '", ' + '"p[7].b[12].font=' + plate01_page7button12font + '", ' + '"p[7].b[13].font=' + plate01_page7button13font + '", ' + '"p[7].b[14].font=' + plate01_page7button14font + '", ' + '"p[7].b[15].font=' + plate01_page7button15font + '", ' + '"p[8].b[4].font=' + plate01_page8button4font + '", ' + '"p[8].b[5].font=' + plate01_page8button5font + '", ' + '"p[8].b[6].font=' + plate01_page8button6font + '", ' + '"p[8].b[7].font=' + plate01_page8button7font + '", ' + '"p[8].b[8].font=' + plate01_page8button8font + '", ' + '"p[9].b[4].font=' + plate01_page9button4font + '", ' + '"p[9].b[5].font=' + plate01_page9button5font + '"]' HASP_Plate01_Plate_Command_JSON.sendCommand(jsonString) end /* Set page button colors based on current page */ rule "HASP Master set page button colors on page change" when Item HASP_Plate01_Page_Current received update then if (HASP_Plate01_Page_Current.state != 0) { var jsonString = '["p['+ (HASP_Plate01_Page_Current.state.toString) + '].b[1].bco=25388", ' + '"p['+ (HASP_Plate01_Page_Current.state.toString) + '].b[2].bco=25388", ' + '"p['+ (HASP_Plate01_Page_Current.state.toString) + '].b[3].bco=25388"' if (HASP_Plate01_Page_Current.state == plate01_pagebutton1page) { jsonString = jsonString + ', "p['+ (HASP_Plate01_Page_Current.state.toString) + '].b[1].bco=65535"]' } else if (HASP_Plate01_Page_Current.state == plate01_pagebutton2page) { jsonString = jsonString + ', "p['+ (HASP_Plate01_Page_Current.state.toString) + '].b[2].bco=65535"]' } else if (HASP_Plate01_Page_Current.state == plate01_pagebutton3page) { jsonString = jsonString + ', "p['+ (HASP_Plate01_Page_Current.state.toString) + '].b[3].bco=65535"]' } else { jsonString = jsonString + ']' } HASP_Plate01_Plate_Command_JSON.sendCommand(jsonString) } end