Announcement

Collapse
No announcement yet.

Keeping a Node-Red Dashboard in sync with HomeSeer

Collapse
This is a sticky topic.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Keeping a Node-Red Dashboard in sync with HomeSeer

    There has been some discussion about keeping a Node Red Dashboard UI sync'd with HomeSeer. The below flow will create a single Toggle for an On/Off light switch and keep it in sync with HomeSeer. If your Node Red server goes off line and comes back on and your switch has changed, this will keep it sync'd as well.
    • Using the Node Red Dashboard UI you can turn the light on and off
    • Using HomeSeer you can turn the light on and off
    • Provided local control is reported back to HomeSeer, yo can use local control to turn the light on and off
    All of the above uses will change the Node Red Dashboard UI switch to show either On or Off. If you turn off your Node Reed server and change the light switch, then turn the server back on, this will update the switch in the Dashboard UI.

    Requirements
    This flow requires the installation of node-red-dashboard as well as the HomeSeer contrib in Node Red.

    Flow Image
    Click image for larger version

Name:	NodeRedDashboardSync.png
Views:	2293
Size:	20.4 KB
ID:	1416997



    Explanation
    From left to right, this flow works as follows:
    • The Light Status is a Status node set to report on a Select Node, which is the HomeSeer Patio Light node. Any time the HomeSeer Patio Light node's Status changes, this node will report the status in msg.status.text with a value matching the Status shown by the HomeSeer device. In the above case this is a string of "On"
    • The Switch node receives the status message and directs output based on the text string of On or Off. On goes to the first output and Off to the second.
    • The two Change nodes Delete the incoming payload and send out a JSON payload of either {"status":"On"} for the top instance or {"status":"Off"} for the bottom.
    • The Patio Light UI Switch is a dashboard UI Switch node (not to be confused with the standard Node-Red switch node type used earlier). This is set as shown below with the key setting being the Pass through and Indicator settings. This will only send the value of the switch to the remainder of the flow if the value changes. So it will not send a value through is the switch itself does not change.
      • Click image for larger version

Name:	NodeRedDashboardSwitch.png
Views:	1974
Size:	30.8 KB
ID:	1416999
    • The On and Off below the Patio Light Switch are Injection Nodes for control from in the flow display.
    • The Patio Light is a HomeSeer device with On/Off capabilities. In this case a light switch.

    JSON to Import

    Code:
    [{"id":"1acd31e7.da334e","type":"tab","label":"GUI Test","disabled":false,"info":""},{"id":"743ba26e.0a346c","type":"ui_switch","z":"1acd31e7.da334e","name":"","label":"Patio Light UI Switch","tooltip":"","group":"4f7a86f3.bd5eb8","order":0,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"control","style":"","onvalue":"{\"status\":\"On\"}","onvalueType":"json","onicon":"","oncolor":"","offvalue":"{\"status\":\"Off\"}","offvalueType":"json","officon":"","offcolor":"","x":660,"y":40,"wires":[["c2762a12.273798"]]},{"id":"c2762a12.273798","type":"hs-device","z":"1acd31e7.da334e","name":"Patio Light","device":"12","server":"fd5a6a5c.dc9868","feature":0,"x":870,"y":80,"wires":[[]]},{"id":"7bf48779.f066c8","type":"status","z":"1acd31e7.da334e","name":"Light Status","scope":["c2762a12.273798"],"x":90,"y":80,"wires":[["f1130c78.ec183"]]},{"id":"41851d20.1395c4","type":"inject","z":"1acd31e7.da334e","name":"On","props":[{"p":"payload.status","v":"On","vt":"str"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"control","x":650,"y":100,"wires":[["c2762a12.273798"]]},{"id":"3b2843f.7bb4dbc","type":"inject","z":"1acd31e7.da334e","name":"Off","props":[{"p":"payload.status","v":"Off","vt":"str"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"control","x":650,"y":140,"wires":[["c2762a12.273798"]]},{"id":"5631bec.c1af84","type":"change","z":"1acd31e7.da334e","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload","pt":"msg","to":"{\"status\":\"On\"}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":40,"wires":[["743ba26e.0a346c"]]},{"id":"f1130c78.ec183","type":"switch","z":"1acd31e7.da334e","name":"","property":"status.text","propertyType":"msg","rules":[{"t":"eq","v":"On","vt":"str"},{"t":"eq","v":"Off","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":250,"y":80,"wires":[["5631bec.c1af84"],["ac92619.c43cea"]]},{"id":"ac92619.c43cea","type":"change","z":"1acd31e7.da334e","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload","pt":"msg","to":"{\"status\":\"Off\"}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":421.59576416015625,"y":106.14030456542969,"wires":[["743ba26e.0a346c"]]},{"id":"4f7a86f3.bd5eb8","type":"ui_group","z":"","name":"Default","tab":"42fec237.9be69c","order":1,"disp":true,"width":"6","collapse":false},{"id":"fd5a6a5c.dc9868","type":"hs-server","z":"","name":"House","host":"192.168.1.10","port":"8008"},{"id":"42fec237.9be69c","type":"ui_tab","z":"","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]
    Attached Files
    Karl S
    HS4Pro on Windows 10
    1070 Devices
    56 Z-Wave Nodes
    104 Events
    HSTouch Clients: 3 Android, 1 iOS
    Google Home: 3 Mini units, 1 Pair Audios, 2 Displays

    #2
    Dealing with multiple devices
    A dashboard is going to have multiple devices. Using the above example, we would introduce many nodes for each device. How can we limit the number of added Nodes?

    Take a look at the full message sent from the Status node:
    Code:
    {"status":
      {"fill":"yellow",
      "shape":"dot",
      "text":"On",
      "source":{
        "id":"c2762a12.273798",
        "type":"hs-device",
        "name":"Patio Light"
      }
    },
    "_msgid":"40df75a3.5f9aec"}
    The message shows that the Status node passes the source which was changed. In this case "Patio Light" as msg.status.source.name. This allows us to add a Switch in after the Change node in the original example and send the payload to any one of many HomeSeer devices. This will save us a bunch of Status to Change nodes. So by adding 5 nodes we keep all our Dashboard items sync'd with HomeSeer items.

    Flow Image
    Click image for larger version

Name:	NodeRedDashboardSync2.png
Views:	1933
Size:	71.2 KB
ID:	1417074

    Devices with more complex status
    This example has been kept simple in that it uses On/Off devices. The initial Switch can be changed to allow for more complex items or you could have different Status nodes for different device types. The output payload will depend on the UI items and the information they are looking for. The concept is the same but you may need a Function instead of a Change node to get the desired output for more complex device status values.

    JSON to Import
    Code:
    [{"id":"1acd31e7.da334e","type":"tab","label":"GUI Test","disabled":false,"info":""},{"id":"743ba26e.0a346c","type":"ui_switch","z":"1acd31e7.da334e","name":"","label":"Patio Light UI Switch","tooltip":"","group":"4f7a86f3.bd5eb8","order":0,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"control","style":"","onvalue":"{\"status\":\"On\"}","onvalueType":"json","onicon":"","oncolor":"","offvalue":"{\"status\":\"Off\"}","offvalueType":"json","officon":"","offcolor":"","x":660,"y":40,"wires":[["c2762a12.273798"]]},{"id":"c2762a12.273798","type":"hs-device","z":"1acd31e7.da334e","name":"Patio Light","device":"12","server":"fd5a6a5c.dc9868","feature":0,"x":870,"y":80,"wires":[[]]},{"id":"7bf48779.f066c8","type":"status","z":"1acd31e7.da334e","name":"Light Status","scope":["c2762a12.273798","a480948e.238248","c877cc40.f38e7","bcdbc91f.95b0b8"],"x":90,"y":40,"wires":[["f1130c78.ec183","68412adc.a02044"]]},{"id":"41851d20.1395c4","type":"inject","z":"1acd31e7.da334e","name":"On","props":[{"p":"payload.status","v":"On","vt":"str"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"control","x":650,"y":100,"wires":[["c2762a12.273798"]]},{"id":"3b2843f.7bb4dbc","type":"inject","z":"1acd31e7.da334e","name":"Off","props":[{"p":"payload.status","v":"Off","vt":"str"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"control","x":650,"y":140,"wires":[["c2762a12.273798"]]},{"id":"5631bec.c1af84","type":"change","z":"1acd31e7.da334e","name":"Set Payload On","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"status\":\"On\"}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":280,"y":260,"wires":[["8f6cce38.e8783"]]},{"id":"f1130c78.ec183","type":"switch","z":"1acd31e7.da334e","name":"","property":"status.text","propertyType":"msg","rules":[{"t":"eq","v":"On","vt":"str"},{"t":"eq","v":"Off","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":110,"y":320,"wires":[["5631bec.c1af84"],["ac92619.c43cea"]]},{"id":"ac92619.c43cea","type":"change","z":"1acd31e7.da334e","name":"Set Payload Off","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"status\":\"Off\"}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":280,"y":380,"wires":[["8f6cce38.e8783"]]},{"id":"c8648d69.34fb4","type":"ui_switch","z":"1acd31e7.da334e","name":"","label":"Deck Lights UI Switch","tooltip":"","group":"4f7a86f3.bd5eb8","order":0,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"control","style":"","onvalue":"{\"status\":\"On\"}","onvalueType":"json","onicon":"","oncolor":"","offvalue":"{\"status\":\"Off\"}","offvalueType":"json","officon":"","offcolor":"","x":660,"y":200,"wires":[["a480948e.238248"]]},{"id":"a480948e.238248","type":"hs-device","z":"1acd31e7.da334e","name":"Deck Lights","device":"65","server":"fd5a6a5c.dc9868","feature":0,"x":870,"y":240,"wires":[[]]},{"id":"76ad3c35.1b79d4","type":"inject","z":"1acd31e7.da334e","name":"On","props":[{"p":"payload.status","v":"On","vt":"str"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"control","x":650,"y":260,"wires":[["a480948e.238248"]]},{"id":"f7dd984b.e8d658","type":"inject","z":"1acd31e7.da334e","name":"Off","props":[{"p":"payload.status","v":"Off","vt":"str"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"control","x":650,"y":300,"wires":[["a480948e.238248"]]},{"id":"1ff4233d.e99b5d","type":"ui_switch","z":"1acd31e7.da334e","name":"","label":"Front Porch Light UI Switch","tooltip":"","group":"4f7a86f3.bd5eb8","order":0,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"control","style":"","onvalue":"{\"status\":\"On\"}","onvalueType":"json","onicon":"","oncolor":"","offvalue":"{\"status\":\"Off\"}","offvalueType":"json","officon":"","offcolor":"","x":680,"y":360,"wires":[["c877cc40.f38e7"]]},{"id":"c877cc40.f38e7","type":"hs-device","z":"1acd31e7.da334e","name":"Front Porch Light","device":"93","server":"fd5a6a5c.dc9868","feature":0,"x":890,"y":400,"wires":[[]]},{"id":"e8a21a7e.5a9bc8","type":"inject","z":"1acd31e7.da334e","name":"On","props":[{"p":"payload.status","v":"On","vt":"str"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"control","x":650,"y":420,"wires":[["c877cc40.f38e7"]]},{"id":"9c09837a.1c80a","type":"inject","z":"1acd31e7.da334e","name":"Off","props":[{"p":"payload.status","v":"Off","vt":"str"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"control","x":650,"y":460,"wires":[["c877cc40.f38e7"]]},{"id":"af7b15b7.f1f268","type":"ui_switch","z":"1acd31e7.da334e","name":"","label":"Landscape Lights UI Switch","tooltip":"","group":"4f7a86f3.bd5eb8","order":0,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"control","style":"","onvalue":"{\"status\":\"On\"}","onvalueType":"json","onicon":"","oncolor":"","offvalue":"{\"status\":\"Off\"}","offvalueType":"json","officon":"","offcolor":"","x":680,"y":520,"wires":[["bcdbc91f.95b0b8"]]},{"id":"bcdbc91f.95b0b8","type":"hs-device","z":"1acd31e7.da334e","name":"Landscape Lights","device":"6","server":"fd5a6a5c.dc9868","feature":0,"x":890,"y":560,"wires":[[]]},{"id":"9cd8891f.53e008","type":"inject","z":"1acd31e7.da334e","name":"On","props":[{"p":"payload.status","v":"On","vt":"str"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"control","x":650,"y":580,"wires":[["bcdbc91f.95b0b8"]]},{"id":"40b452c2.2d516c","type":"inject","z":"1acd31e7.da334e","name":"Off","props":[{"p":"payload.status","v":"Off","vt":"str"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"control","x":650,"y":620,"wires":[["bcdbc91f.95b0b8"]]},{"id":"8f6cce38.e8783","type":"switch","z":"1acd31e7.da334e","name":"","property":"status.source.name","propertyType":"msg","rules":[{"t":"eq","v":"Patio Light","vt":"str"},{"t":"eq","v":"Deck Lights","vt":"str"},{"t":"eq","v":"Front Porch Light","vt":"str"},{"t":"eq","v":"Landscape Lights","vt":"str"}],"checkall":"false","repair":false,"outputs":4,"x":430,"y":320,"wires":[["743ba26e.0a346c"],["c8648d69.34fb4"],["1ff4233d.e99b5d"],["af7b15b7.f1f268"]]},{"id":"68412adc.a02044","type":"debug","z":"1acd31e7.da334e","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":380,"y":60,"wires":[]},{"id":"4f7a86f3.bd5eb8","type":"ui_group","z":"","name":"Default","tab":"42fec237.9be69c","order":1,"disp":true,"width":"6","collapse":false},{"id":"fd5a6a5c.dc9868","type":"hs-server","z":"","name":"House","host":"192.168.1.10","port":"8008"},{"id":"42fec237.9be69c","type":"ui_tab","z":"","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

    Karl S
    HS4Pro on Windows 10
    1070 Devices
    56 Z-Wave Nodes
    104 Events
    HSTouch Clients: 3 Android, 1 iOS
    Google Home: 3 Mini units, 1 Pair Audios, 2 Displays

    Comment


      #3
      Dealing with dimmable devices
      Everything so far has dealt with On/Off devices, so it has been simple. What about a dimmable device? In this case we have settings for On, Off, Last, and a numeric range. I am going to use 2 UI items for each of these devices. An On/Off and a Slider. This way we can quickly turn a light Off with the On/Off UI item and can turn it on in a couple ways: 1) by changing the value of the Slider 2) to the Last level using the On/Off UI item, making in a Last/Off switch.


      Flow Image
      This is the portion of the flow we will be adding to our existing dashboard. The Switch node with only 1 outbound wire and 4 items left of that are the same as the first set of nodes from the previous posts.

      Click image for larger version

Name:	NodeRedDashboardSyncDimmer1.png
Views:	2086
Size:	27.5 KB
ID:	1421346
      Ultimately the flow will look like this. Adding a second dimmable light and using Subflows to make the redundant items reusable. A Subflow will allow us to edit code once and use it in multiple locations. I also removed the injection nodes to each of the earlier On/Off switches as they are not necessary
      Click image for larger version

Name:	NodeRedDashboardSyncDimmer2.png
Views:	1700
Size:	241.2 KB
ID:	1421347


      The Last/Off switch
      This item requires a minor modification to our earlier setup. We add to the first Switch node to deal with the status of Last. This gets wired to the On Change node. From there the flow moves to the Switch node to determine what was changed, so we add an entry for this UI item and connect that to the Office switch On/Off.


      Setting the slider
      The Slider UI is where we need to add a couple items. First, we edit the first Switch node in the flow to add an output in case the status sent contains "Dim" without the quotes. This is the last change we make to this node, so it now appears as shown below.

      Click image for larger version

Name:	NodeRedDashboardSyncDimmerUISliderModifiedChange1.png
Views:	1669
Size:	25.4 KB
ID:	1421348
      To handle the output if the Dim value, we need a Change node, shown below, to make this something we can use in the slider. The Status sent is "Dim 60%" for a level of 60%. We are going to set msg.payload to the number from that string by setting it to the Expression
      Code:
      $number(    $split(status.text, /%| /, 2)[1]    )
      This does the following: $split(status.text, /%| /, 2) splits the string into 2 parts, split on a space or % character. This creates an array, with the following ["Dim", "60"] and array items are accessed by the arrayname[x] where x is the item in the array, starting with the first item as 0 So adding [1] at the end of the $split() function gives us the second item in the array. This is all wrapped in $number(), changing the String of "60" to the Number 60, so we can use it in the Slider UI item.

      Click image for larger version

Name:	NodeRedDashboardSyncDimmerChange1.png
Views:	1630
Size:	19.2 KB
ID:	1421349
      This change node is wired to the Office Level slider. Once we add more than one controlled dimmable unit to this dashboard, we use a Switch node configured the same as the one after our Set Payload On and Set Payload Off change nodes from the previous post. The only difference is that this one switches us to the appropriate Slider as opposed to an On/Off switch.


      The UI Items
      There is nothing different in the UI Switch item from the previous posts. These are configured the same, so refer to the previous posts for information or copy one if you have any.
      The Slider has the box checked next to "If msg arrives on input, set slider to new payload value" and the Output dropdown can be whichever setting you prefer. I used "continuous while sliding" so I can see the light change as I change the slider.


      Controlling the HomeSeer Device
      All that is left is to control the HomeSeer device. From the On/Off switch we use a switch node to send the "Off" payload directly to the HomeSeer device. The "On" payload is changed to "Last" using a change node and then sent to the HomeSeer device so it comes on at the last dim level.
      The slider's message needs to be changed to a JSON object for the payload and we need to set the topic to "Control" as shown below.

      Click image for larger version

Name:	NodeRedDashboardSyncDimmerUISliderChange1.png
Views:	1652
Size:	23.3 KB
ID:	1421350


      Cleaning it up for multiple UI items
      The section of nodes between the UI items and the HomeSeer device will be the same for every HomeSeer device we will add to the dashboard. While we could copy and paste these, that creates a lot of edits if (read WHEN) we have to make a change. Saving these as Subflows will allow us to re-use them and make it so we edit one item and it changes in all uses. To make a Subflow, select the "Switch" and "Set Last" (change) nodes after the "Office Switch" node. You can hold the mouse button and drag your cursor to make a box which crosses them or hold the Ctrl key and select each if using Windows. For a different OS, use your favorite way to select multiple items. Once these items are selected, go to the 3-line hamburger menu in the top right of the work area and select Subflows->Selection to Subflows. This will create a node called "subflow 1" which you can double click on and find an Edit subflow button. Edit the subflow so that both output wires lead to "output 1" and delete "output 2" since these will both go to the same device.
      Make the solo change node after the slider UI item a subflow as well. This way you will not have to edit anything and if you need to add a changed value later you can.
      You will now see two subflows in your available palettes on the left which you can add as needed.

      JSON to Import
      This would be the JSON for an individual slider group. Representing the first image in this post's flow images above.
      Code:
      [{"id":"ebe02cab.a8e67","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"575f6c64.6bd6c4","type":"hs-device","z":"ebe02cab.a8e67","name":"Office Light","device":"27","server":"fd5a6a5c.dc9868","feature":0,"x":1070,"y":180,"wires":[[]]},{"id":"938ea04d.2d4dd","type":"change","z":"ebe02cab.a8e67","name":"","rules":[{"t":"set","p":"oldpayload","pt":"msg","to":"payload","tot":"msg"},{"t":"set","p":"payload","pt":"msg","to":"{\"value\":oldpayload}","tot":"jsonata"},{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":880,"y":220,"wires":[["575f6c64.6bd6c4"]]},{"id":"5aa1783.f1c9a88","type":"switch","z":"ebe02cab.a8e67","name":"","property":"payload.status","propertyType":"msg","rules":[{"t":"eq","v":"On","vt":"str"},{"t":"eq","v":"Off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":830,"y":160,"wires":[["c9069ebe.7bbe2"],["575f6c64.6bd6c4"]]},{"id":"c9069ebe.7bbe2","type":"change","z":"ebe02cab.a8e67","name":"Set Last","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"value\":255}","tot":"json"},{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":950,"y":120,"wires":[["575f6c64.6bd6c4"]]},{"id":"5aee312d.2aceb","type":"ui_switch","z":"ebe02cab.a8e67","name":"","label":"Office Switch","tooltip":"","group":"4f7a86f3.bd5eb8","order":2,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"control","style":"","onvalue":"{\"status\":\"On\"}","onvalueType":"json","onicon":"","oncolor":"","offvalue":"{\"status\":\"Off\"}","offvalueType":"json","officon":"","offcolor":"","x":690,"y":160,"wires":[["5aa1783.f1c9a88"]]},{"id":"b3ae0040.da1e6","type":"ui_slider","z":"ebe02cab.a8e67","name":"","label":"Office Level","tooltip":"","group":"4f7a86f3.bd5eb8","order":3,"width":0,"height":0,"passthru":true,"outs":"all","topic":"","min":0,"max":"100","step":1,"x":690,"y":220,"wires":[["938ea04d.2d4dd"]]},{"id":"274a059c.ed36ea","type":"change","z":"ebe02cab.a8e67","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$number(\t$split(status.text, /%| /, 2)[1]\t)","tot":"jsonata"},{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":220,"wires":[["b3ae0040.da1e6"]]},{"id":"d5380083.e3664","type":"switch","z":"ebe02cab.a8e67","name":"","property":"status.source.name","propertyType":"msg","rules":[{"t":"eq","v":"Patio Light","vt":"str"},{"t":"eq","v":"Deck Lights","vt":"str"},{"t":"eq","v":"Front Porch Light","vt":"str"},{"t":"eq","v":"Landscape Lights","vt":"str"},{"t":"eq","v":"Office Light","vt":"str"}],"checkall":"false","repair":false,"outputs":5,"x":550,"y":100,"wires":[[],[],[],[],["5aee312d.2aceb"]]},{"id":"2425b7ad.8b71b8","type":"change","z":"ebe02cab.a8e67","name":"Set Payload On","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"status\":\"On\"}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":40,"wires":[["d5380083.e3664"]]},{"id":"d4e57f9.99e248","type":"change","z":"ebe02cab.a8e67","name":"Set Payload Off","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"status\":\"Off\"}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":120,"wires":[["d5380083.e3664"]]},{"id":"840fd55b.443398","type":"switch","z":"ebe02cab.a8e67","name":"","property":"status.text","propertyType":"msg","rules":[{"t":"eq","v":"On","vt":"str"},{"t":"eq","v":"Last","vt":"str"},{"t":"eq","v":"Off","vt":"str"},{"t":"cont","v":"Dim","vt":"str"}],"checkall":"false","repair":false,"outputs":4,"x":230,"y":100,"wires":[["2425b7ad.8b71b8"],["2425b7ad.8b71b8"],["d4e57f9.99e248"],["274a059c.ed36ea","2425b7ad.8b71b8"]]},{"id":"48c38d83.bbd3b4","type":"status","z":"ebe02cab.a8e67","name":"Light Status","scope":["c2762a12.273798","a480948e.238248","c877cc40.f38e7","bcdbc91f.95b0b8","575f6c64.6bd6c4"],"x":90,"y":40,"wires":[["840fd55b.443398","2e9c45c8.92f76a"]]},{"id":"2e9c45c8.92f76a","type":"debug","z":"ebe02cab.a8e67","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":260,"y":320,"wires":[]},{"id":"fd5a6a5c.dc9868","type":"hs-server","z":"","name":"House","host":"192.168.1.10","port":"8008"},{"id":"4f7a86f3.bd5eb8","type":"ui_group","z":"","name":"Default","tab":"42fec237.9be69c","order":1,"disp":true,"width":"6","collapse":false},{"id":"42fec237.9be69c","type":"ui_tab","z":"","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]
      The complete flow of the On/Of and dimmable UI items is here in case you need it:
      Code:
      [{"id":"46e28ca6.b663d4","type":"subflow","name":"Change Slider to Light Switch Dim Control","info":"","category":"","in":[{"x":40,"y":80,"wires":[{"id":"8f663eb5.916e1"}]}],"out":[{"x":360,"y":80,"wires":[{"id":"8f663eb5.916e1","port":0}]}],"env":[],"color":"#DDAA99"},{"id":"8f663eb5.916e1","type":"change","z":"46e28ca6.b663d4","name":"","rules":[{"t":"set","p":"oldpayload","pt":"msg","to":"payload","tot":"msg"},{"t":"set","p":"payload","pt":"msg","to":"{\"value\":oldpayload}","tot":"jsonata"},{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":200,"y":80,"wires":[[]]},{"id":"803087e4.0721d8","type":"subflow","name":"Dimmer Switch On to Last","info":"","category":"","in":[{"x":60,"y":120,"wires":[{"id":"f8e4adaa.04cad"}]}],"out":[{"x":440,"y":120,"wires":[{"id":"95c2ac53.328e9","port":0},{"id":"f8e4adaa.04cad","port":1}]}],"env":[],"color":"#DDAA99"},{"id":"f8e4adaa.04cad","type":"switch","z":"803087e4.0721d8","name":"","property":"payload.status","propertyType":"msg","rules":[{"t":"eq","v":"On","vt":"str"},{"t":"eq","v":"Off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":190,"y":120,"wires":[["95c2ac53.328e9"],[]]},{"id":"95c2ac53.328e9","type":"change","z":"803087e4.0721d8","name":"Set Last","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"value\":255}","tot":"json"},{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":310,"y":80,"wires":[[]]},{"id":"1acd31e7.da334e","type":"tab","label":"GUI Test","disabled":false,"info":""},{"id":"e3e6789b.858d88","type":"group","z":"1acd31e7.da334e","name":"Outside Lights","style":{"label":true},"nodes":["743ba26e.0a346c","c2762a12.273798","c8648d69.34fb4","a480948e.238248","1ff4233d.e99b5d","c877cc40.f38e7","af7b15b7.f1f268","bcdbc91f.95b0b8"],"x":534,"y":99,"w":472,"h":342},{"id":"743ba26e.0a346c","type":"ui_switch","z":"1acd31e7.da334e","g":"e3e6789b.858d88","name":"","label":"Patio Light UI Switch","tooltip":"","group":"45f468ca.739e98","order":4,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"control","style":"","onvalue":"{\"status\":\"On\"}","onvalueType":"json","onicon":"","oncolor":"","offvalue":"{\"status\":\"Off\"}","offvalueType":"json","officon":"","offcolor":"","x":660,"y":140,"wires":[["c2762a12.273798"]]},{"id":"c2762a12.273798","type":"hs-device","z":"1acd31e7.da334e","g":"e3e6789b.858d88","name":"Patio Light","device":"12","server":"fd5a6a5c.dc9868","feature":0,"x":870,"y":180,"wires":[[]]},{"id":"7bf48779.f066c8","type":"status","z":"1acd31e7.da334e","name":"Light Status","scope":["c2762a12.273798","a480948e.238248","c877cc40.f38e7","bcdbc91f.95b0b8","2cf5e0c.532222","ec623ca0.8cff8"],"x":90,"y":140,"wires":[["f1130c78.ec183"]]},{"id":"5631bec.c1af84","type":"change","z":"1acd31e7.da334e","name":"Set Payload On","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"status\":\"On\"}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":280,"y":260,"wires":[["8f6cce38.e8783"]]},{"id":"f1130c78.ec183","type":"switch","z":"1acd31e7.da334e","name":"","property":"status.text","propertyType":"msg","rules":[{"t":"eq","v":"On","vt":"str"},{"t":"eq","v":"Last","vt":"str"},{"t":"eq","v":"Off","vt":"str"},{"t":"cont","v":"Dim","vt":"str"}],"checkall":"false","repair":false,"outputs":4,"x":110,"y":320,"wires":[["5631bec.c1af84"],["5631bec.c1af84"],["ac92619.c43cea"],["e1c4c774.367258","5631bec.c1af84"]]},{"id":"ac92619.c43cea","type":"change","z":"1acd31e7.da334e","name":"Set Payload Off","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"status\":\"Off\"}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":280,"y":340,"wires":[["8f6cce38.e8783"]]},{"id":"c8648d69.34fb4","type":"ui_switch","z":"1acd31e7.da334e","g":"e3e6789b.858d88","name":"","label":"Deck Lights UI Switch","tooltip":"","group":"45f468ca.739e98","order":5,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"control","style":"","onvalue":"{\"status\":\"On\"}","onvalueType":"json","onicon":"","oncolor":"","offvalue":"{\"status\":\"Off\"}","offvalueType":"json","officon":"","offcolor":"","x":660,"y":200,"wires":[["a480948e.238248"]]},{"id":"a480948e.238248","type":"hs-device","z":"1acd31e7.da334e","g":"e3e6789b.858d88","name":"Deck Lights","device":"65","server":"fd5a6a5c.dc9868","feature":0,"x":870,"y":240,"wires":[[]]},{"id":"1ff4233d.e99b5d","type":"ui_switch","z":"1acd31e7.da334e","g":"e3e6789b.858d88","name":"","label":"Front Porch Light UI Switch","tooltip":"","group":"45f468ca.739e98","order":6,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"control","style":"","onvalue":"{\"status\":\"On\"}","onvalueType":"json","onicon":"","oncolor":"","offvalue":"{\"status\":\"Off\"}","offvalueType":"json","officon":"","offcolor":"","x":680,"y":280,"wires":[["c877cc40.f38e7"]]},{"id":"c877cc40.f38e7","type":"hs-device","z":"1acd31e7.da334e","g":"e3e6789b.858d88","name":"Front Porch Light","device":"93","server":"fd5a6a5c.dc9868","feature":0,"x":890,"y":320,"wires":[[]]},{"id":"af7b15b7.f1f268","type":"ui_switch","z":"1acd31e7.da334e","g":"e3e6789b.858d88","name":"","label":"Landscape Lights UI Switch","tooltip":"","group":"45f468ca.739e98","order":7,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"control","style":"","onvalue":"{\"status\":\"On\"}","onvalueType":"json","onicon":"","oncolor":"","offvalue":"{\"status\":\"Off\"}","offvalueType":"json","officon":"","offcolor":"","x":680,"y":360,"wires":[["bcdbc91f.95b0b8"]]},{"id":"bcdbc91f.95b0b8","type":"hs-device","z":"1acd31e7.da334e","g":"e3e6789b.858d88","name":"Landscape Lights","device":"6","server":"fd5a6a5c.dc9868","feature":0,"x":890,"y":400,"wires":[[]]},{"id":"8f6cce38.e8783","type":"switch","z":"1acd31e7.da334e","name":"","property":"status.source.name","propertyType":"msg","rules":[{"t":"eq","v":"Patio Light","vt":"str"},{"t":"eq","v":"Deck Lights","vt":"str"},{"t":"eq","v":"Front Porch Light","vt":"str"},{"t":"eq","v":"Landscape Lights","vt":"str"},{"t":"eq","v":"Office Light","vt":"str"},{"t":"eq","v":"TV Room Couch","vt":"str"}],"checkall":"false","repair":false,"outputs":6,"x":430,"y":320,"wires":[["743ba26e.0a346c"],["c8648d69.34fb4"],["1ff4233d.e99b5d"],["af7b15b7.f1f268"],["69b556c3.a33258"],["713ff2f9.a5581c"]]},{"id":"f637473c.7701f8","type":"hs-device","z":"1acd31e7.da334e","name":"","device":"64","server":"fd5a6a5c.dc9868","feature":0,"x":170,"y":1240,"wires":[["13209be4.e63334","e02c09f8.469b78"]]},{"id":"e02c09f8.469b78","type":"debug","z":"1acd31e7.da334e","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":870,"y":1180,"wires":[]},{"id":"13209be4.e63334","type":"switch","z":"1acd31e7.da334e","name":"test","property":"payload.status","propertyType":"msg","rules":[{"t":"cont","v":"5","vt":"num"},{"t":"cont","v":"Dim","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":330,"y":1240,"wires":[["2b2d5704.c9d158"],["c2a31053.973c"],["1ef9f72e.77d8c9"]]},{"id":"2b2d5704.c9d158","type":"change","z":"1acd31e7.da334e","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"msg.status","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":1240,"wires":[["e02c09f8.469b78"]]},{"id":"1ef9f72e.77d8c9","type":"change","z":"1acd31e7.da334e","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"test","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":520,"y":1300,"wires":[["e02c09f8.469b78"]]},{"id":"c2a31053.973c","type":"change","z":"1acd31e7.da334e","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"dim","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":561.6187744140625,"y":1353.3154296875,"wires":[["e02c09f8.469b78"]]},{"id":"2cf5e0c.532222","type":"hs-device","z":"1acd31e7.da334e","name":"Office Light","device":"27","server":"fd5a6a5c.dc9868","feature":0,"x":1170,"y":500,"wires":[[]]},{"id":"d287786c.eaebc8","type":"ui_slider","z":"1acd31e7.da334e","name":"","label":"Office Level","tooltip":"","group":"4f7a86f3.bd5eb8","order":3,"width":0,"height":0,"passthru":true,"outs":"all","topic":"","min":0,"max":"100","step":1,"x":650,"y":560,"wires":[["fe7abbf7.21ba48"]]},{"id":"e1c4c774.367258","type":"change","z":"1acd31e7.da334e","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$number(\t$split(status.text, /%| /, 2)[1]\t)","tot":"jsonata"},{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":180,"y":560,"wires":[["d7d22a50.3f4588"]]},{"id":"69b556c3.a33258","type":"ui_switch","z":"1acd31e7.da334e","name":"","label":"Office Switch","tooltip":"","group":"4f7a86f3.bd5eb8","order":2,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"control","style":"","onvalue":"{\"status\":\"On\"}","onvalueType":"json","onicon":"","oncolor":"","offvalue":"{\"status\":\"Off\"}","offvalueType":"json","officon":"","offcolor":"","x":650,"y":500,"wires":[["1505648d.7c994b"]]},{"id":"1505648d.7c994b","type":"subflow:803087e4.0721d8","z":"1acd31e7.da334e","name":"Dimmer Switch On to Last","env":[],"x":870,"y":500,"wires":[["2cf5e0c.532222"]]},{"id":"fe7abbf7.21ba48","type":"subflow:46e28ca6.b663d4","z":"1acd31e7.da334e","name":"Change Slider to Light Switch Dim Control","env":[],"x":920,"y":560,"wires":[["2cf5e0c.532222"]]},{"id":"d7d22a50.3f4588","type":"switch","z":"1acd31e7.da334e","name":"","property":"status.source.name","propertyType":"msg","rules":[{"t":"eq","v":"Office Light","vt":"str"},{"t":"eq","v":"TV Room Couch","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":390,"y":620,"wires":[["d287786c.eaebc8"],["5ec8c2.e583c74"]]},{"id":"5ec8c2.e583c74","type":"ui_slider","z":"1acd31e7.da334e","name":"","label":"TV Room Couch Level","tooltip":"","group":"4f7a86f3.bd5eb8","order":3,"width":0,"height":0,"passthru":true,"outs":"all","topic":"","min":0,"max":"100","step":1,"x":680,"y":680,"wires":[["fc697f68.47f94"]]},{"id":"ec623ca0.8cff8","type":"hs-device","z":"1acd31e7.da334e","name":"TV Room Couch","device":"31","server":"fd5a6a5c.dc9868","feature":0,"x":1190,"y":620,"wires":[[]]},{"id":"3813269c.60e22a","type":"subflow:803087e4.0721d8","z":"1acd31e7.da334e","name":"","x":950,"y":620,"wires":[["ec623ca0.8cff8"]]},{"id":"fc697f68.47f94","type":"subflow:46e28ca6.b663d4","z":"1acd31e7.da334e","name":"","x":980,"y":680,"wires":[["ec623ca0.8cff8"]]},{"id":"713ff2f9.a5581c","type":"ui_switch","z":"1acd31e7.da334e","name":"","label":"TV Room Couch Switch","tooltip":"","group":"4f7a86f3.bd5eb8","order":2,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"control","style":"","onvalue":"{\"status\":\"On\"}","onvalueType":"json","onicon":"","oncolor":"","offvalue":"{\"status\":\"Off\"}","offvalueType":"json","officon":"","offcolor":"","x":690,"y":620,"wires":[["3813269c.60e22a"]]},{"id":"45f468ca.739e98","type":"ui_group","z":"","name":"Outside Lights","tab":"42fec237.9be69c","order":2,"disp":true,"width":"3","collapse":true},{"id":"fd5a6a5c.dc9868","type":"hs-server","z":"","name":"House","host":"192.168.1.10","port":"8008"},{"id":"4f7a86f3.bd5eb8","type":"ui_group","z":"","name":"Default","tab":"42fec237.9be69c","order":1,"disp":true,"width":"6","collapse":false},{"id":"42fec237.9be69c","type":"ui_tab","z":"","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]
      And for completeness, here are the two subflows. The On/OFF subflow:
      Code:
      [{"id":"803087e4.0721d8","type":"subflow","name":"Dimmer Switch On to Last","info":"","category":"","in":[{"x":60,"y":120,"wires":[{"id":"f8e4adaa.04cad"}]}],"out":[{"x":440,"y":120,"wires":[{"id":"95c2ac53.328e9","port":0},{"id":"f8e4adaa.04cad","port":1}]}],"env":[],"color":"#DDAA99"},{"id":"f8e4adaa.04cad","type":"switch","z":"803087e4.0721d8","name":"","property":"payload.status","propertyType":"msg","rules":[{"t":"eq","v":"On","vt":"str"},{"t":"eq","v":"Off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":190,"y":120,"wires":[["95c2ac53.328e9"],[]]},{"id":"95c2ac53.328e9","type":"change","z":"803087e4.0721d8","name":"Set Last","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"value\":255}","tot":"json"},{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":310,"y":80,"wires":[[]]}]
      and the slider
      Code:
      [{"id":"46e28ca6.b663d4","type":"subflow","name":"Change Slider to Light Switch Dim Control","info":"","category":"","in":[{"x":40,"y":80,"wires":[{"id":"8f663eb5.916e1"}]}],"out":[{"x":360,"y":80,"wires":[{"id":"8f663eb5.916e1","port":0}]}],"env":[],"color":"#DDAA99"},{"id":"8f663eb5.916e1","type":"change","z":"46e28ca6.b663d4","name":"","rules":[{"t":"set","p":"oldpayload","pt":"msg","to":"payload","tot":"msg"},{"t":"set","p":"payload","pt":"msg","to":"{\"value\":oldpayload}","tot":"jsonata"},{"t":"set","p":"topic","pt":"msg","to":"control","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":200,"y":80,"wires":[[]]}]
      Last edited by ksum; September 23, 2020, 04:53 PM. Reason: Attempt to fix image upload problem
      Karl S
      HS4Pro on Windows 10
      1070 Devices
      56 Z-Wave Nodes
      104 Events
      HSTouch Clients: 3 Android, 1 iOS
      Google Home: 3 Mini units, 1 Pair Audios, 2 Displays

      Comment


        #4
        ksum That is one of the most detailed writeups I have ever seen on these forums. Nice job.

        Comment


          #5
          I agree. Can you update the images in todays post. They're broken in my view...

          Thank you!
          HS3PRO 3.0.0.500 as a Fire Daemon service, Windows 2016 Server Std Intel Core i5 PC HTPC Slim SFF 4GB, 120GB SSD drive, WLG800, RFXCom, TI103,NetCam, UltraNetcam3, BLBackup, CurrentCost 3P Rain8Net, MCsSprinker, HSTouch, Ademco Security plugin/AD2USB, JowiHue, various Oregon Scientific temp/humidity sensors, Z-Net, Zsmoke, Aeron Labs micro switches, Amazon Echo Dots, WS+, WD+ ... on and on.

          Comment


            #6
            Thank you both. I started this as a result of many questions which were coming up and a desire to make a single location to find the information. Ideally we would have a wiki site or something where the community could post and edit pages. It would be nice to have one place to go and have living pages that were updated with information as capabilities change or a different (better?) way is presented. I am sure there are changes which could be made to my dashboard which I am not aware of that would make it cleaner. The Subflow is an example. But could UI items be generated in Subflows with different names and locations? Anyway, I digress...

            langenet DM me if the images do not come through now. I opened the post in a different browser and they were missing for me as well. I edited to replace them and they are now showing in that browser also.

            Karl

            Karl S
            HS4Pro on Windows 10
            1070 Devices
            56 Z-Wave Nodes
            104 Events
            HSTouch Clients: 3 Android, 1 iOS
            Google Home: 3 Mini units, 1 Pair Audios, 2 Displays

            Comment


              #7
              This should be stickied.

              Comment


                #8
                Does anyone have issue that the status node gives undefined payload?
                I have tried to test with status node that should give status on a homeseer switch, but it is not outputting anything.
                Click image for larger version

Name:	2020-11-25_09-39-19.png
Views:	1477
Size:	237.3 KB
ID:	1436044

                Comment


                  #9
                  I would be interested in seeing how your Status node is set up, frankis78 Can you get a screen shot of the settings? Below is how mine is set.
                  ​​​​​​​​

                  image widget
                  Karl S
                  HS4Pro on Windows 10
                  1070 Devices
                  56 Z-Wave Nodes
                  104 Events
                  HSTouch Clients: 3 Android, 1 iOS
                  Google Home: 3 Mini units, 1 Pair Audios, 2 Displays

                  Comment


                    #10
                    Hi, here it is
                    Click image for larger version

Name:	2020-11-26_00-26-00.png
Views:	1415
Size:	200.0 KB
ID:	1436186

                    Comment


                      #11
                      Set your Debug node to show the Complete Message Object. The Status node returns msg.status and msg.payload is not defined. Your setting is only showing the contents of msg.payload
                      Karl S
                      HS4Pro on Windows 10
                      1070 Devices
                      56 Z-Wave Nodes
                      104 Events
                      HSTouch Clients: 3 Android, 1 iOS
                      Google Home: 3 Mini units, 1 Pair Audios, 2 Displays

                      Comment


                        #12
                        Great catch, thanks a loot. Didnt even know of that function on the debug node. I thought i parsed everything by default
                        Now it works😀
                        Click image for larger version

Name:	2020-11-26_19-05-29.png
Views:	1393
Size:	313.9 KB
ID:	1436341

                        Comment


                          #13
                          msg.payload is normally the important part and the one which is most overwritten by the various nodes. Other keys under msg are normally fairly stable so less need to report them.
                          Karl S
                          HS4Pro on Windows 10
                          1070 Devices
                          56 Z-Wave Nodes
                          104 Events
                          HSTouch Clients: 3 Android, 1 iOS
                          Google Home: 3 Mini units, 1 Pair Audios, 2 Displays

                          Comment


                            #14
                            New to Node-Red. I did it like this, not sure if its a bad idea.

                            Comment


                              #15
                              ksum Hey,

                              Just wondering. What do you do with this dashboard? Is is for a tablet with touch ( if yes I am curious what it looks like an tablet) .Or something else?

                              Comment

                              Working...
                              X