Announcement

Collapse
No announcement yet.

Trying to check the status of 3 features.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Trying to check the status of 3 features.

    I just started to work with node red and see tons of possibilities for us. Currently is there a way for node red to check the state of three different devices and if they all meet certain criteria to trigger a command in node red? To be more specific, If our garage door is open, and 2 geo fences are false, trigger node red to send a message via http request. Any help would be greatly appreciated.

    Thank you!

    #2
    Just tried this and I think it works:

    Click image for larger version  Name:	Capture.JPG Views:	0 Size:	38.5 KB ID:	1441925Click image for larger version  Name:	Capture-switch.JPG Views:	0 Size:	31.5 KB ID:	1441926

    If a zone is closed (0), then the payload goes to the top flow.

    If zone is open (1), then the payload goes to the bottom flow.

    I don't know yet how to check if all are open or closed but I think this is the right direction.

    -Devan

    Comment


      #3
      Version 2:

      Click image for larger version

Name:	Capture.JPG
Views:	205
Size:	31.1 KB
ID:	1441941Click image for larger version

Name:	Capture-switch.JPG
Views:	196
Size:	51.8 KB
ID:	1441942

      This flow uses the booleanlogicultimate node. That node performs AND / OR / XOR on a user defined number of inputs. I will donate to the genius who made that after this post.

      As I have designed this, if I open any window in that zone, my browser reports "open" since either 1 or 2 or 3 are true.

      The change rules move msg.payload.value to msg.payload and creates a unique msg.topic for each input (needed by boolean node)

      Hope this helps,

      -Devan

      Comment


        #4
        For your use, you would have two boolean nodes. One to see if both geofences are false and secondary one to see if garage is open (or locked = false) and geofence 1 and geofence 2 are false, then trigger. It would be much better to phrase those as true statements so that the node will only trigger if all are true.

        Comment


          #5
          Thank you everyone. I appreciate the help. This helped immensely!

          Comment


            #6
            For reference this is my final flow:

            It changes the status of a virtual device if any sensor is open. When all sensors are closed, it changes the status of the virtual device to closed.

            It only sends reports on a change in status of the virtual device.

            Click image for larger version

Name:	Capture.JPG
Views:	220
Size:	64.7 KB
ID:	1442259

            Comment


              #7
              I am not sure what the Sync node is doing outside probably injecting a msg.topic=sync in order to get the current values of the Homeseer devices. I believe it may be triggering the flow at a given time interval as well? If that is the case, I would use a Status node in its place and select the HomeSeer devices you wish to report when the status of one of them changes. This is a core node which sends a msg whenever the status of the monitored node/nodes changes. If it is monitoring 3 nodes, it will send the status of the two which have not changed. I would wire that to a Change node to set the msg.topic=sync and then wire that into HomeSeer nodes for the devices you wish to check. This basically uses the Status node as a trigger to initiate the flow. In this scenario I would probably add a boolean to the initial Cahnge node as well, such as msg.checkStatus and only pass the flow beyond a point when that is true. Another option would be to have the Status node at the same level as teh HomeSeer nodes, but this requires the nodes after that point to do something consistent with the msg object data.

              Without the exported flow, the image only points us to ideas of using specific nodes, not how they are used. I am imagining the nodes between the HomeSeer and BooleanLogicUltimate or maybe even the RBE nodes could be made into a subflow at the very least. If they are consistent in what they do this would mean future updates only require editing one set of nodes instrad of one for each device.

              I was trying to come up with a way of using the built in Join node to do this but between that and updating my network to bridge the ISP and use a Unifi Dream Machine Pro my Node Red flows became corrupt and I am still recovering some of them. The BooleanUltimateLogic node is an interesting find and does allow for less nodes in the flow, which is nice.
              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


                #8
                how should I share the flow effectively? Currently I am just taking screenshots.

                You are right about the inject node. It sends a sync and then sends one every 30s.

                How does the status node know when a device's status changes? Does HS4 send unsolicited status changes to NR? I thought I was stuck, in essence, polling every 30s.

                Thanks,

                Devan

                Comment


                  #9
                  To share the flow, Export it following the instructions here. When you paste it in a message, it is best to put it in Code tags.

                  HomeSeer devices trigger a flow when their status/value changes. They can also report their status on startup of Node Red, which is on a server reboot or when you Deploy a flow by checking the "Report on startup" box in the node properties.

                  The Status node can be set to trigger on the change of status on all nodes in the tab, or specific ones. I would configure it for specific ones. At that point it sends a message with the status of each. Here is a Status node set to report the status of a couple HomeSeer devices. When one of them changes, the status of the others is reported. I use it to start a flow for a dashboard, as can be seen in the Dashboard example I wrote up.
                  Click image for larger version

Name:	hs3.png
Views:	185
Size:	30.7 KB
ID:	1442734
                  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
                    As Karl suggested, the sync node was unnecessary. Actually the flow works without a status node as well. Here is the updated flow to check to see if any device is open and to return to closed state if all become closed. I'm using this to reduce the heat if someone opens a window or door for a minute.

                    Code:
                    [
                    {
                    "id": "eb0c633.d20572",
                    "type": "hs-device",
                    "z": "94606e09.7a27f",
                    "name": "TV east",
                    "device": "1225",
                    "server": "1bd28fbf.5b421",
                    "feature": "1235",
                    "reportonstartup": false,
                    "x": 280,
                    "y": 280,
                    "wires": [
                    [
                    "5bf55d04.debe94"
                    ]
                    ]
                    },
                    {
                    "id": "657cf929.ef4358",
                    "type": "hs-device",
                    "z": "94606e09.7a27f",
                    "name": "TV nook",
                    "device": "1225",
                    "server": "1bd28fbf.5b421",
                    "feature": "1234",
                    "reportonstartup": false,
                    "x": 280,
                    "y": 340,
                    "wires": [
                    [
                    "a4346740.99dad"
                    ]
                    ]
                    },
                    {
                    "id": "7c64145b.ab49fc",
                    "type": "hs-device",
                    "z": "94606e09.7a27f",
                    "name": "TV north",
                    "device": "1225",
                    "server": "1bd28fbf.5b421",
                    "feature": "1236",
                    "reportonstartup": false,
                    "x": 280,
                    "y": 400,
                    "wires": [
                    [
                    "ca6f8f7e.694db"
                    ]
                    ]
                    },
                    {
                    "id": "aa50dfeb.a2aac8",
                    "type": "BooleanLogicUltimate",
                    "z": "94606e09.7a27f",
                    "name": "Any zone open?",
                    "filtertrue": "onlytrue",
                    "persist": false,
                    "sInitializeWith": "WaitForPayload",
                    "triggertopic": "trigger",
                    "outputtriggeredby": "all",
                    "inputCount": "5",
                    "topic": "result",
                    "x": 160,
                    "y": 600,
                    "wires": [
                    [],
                    [
                    "1a5e716e.cc3edf"
                    ],
                    []
                    ]
                    },
                    {
                    "id": "5bf55d04.debe94",
                    "type": "change",
                    "z": "94606e09.7a27f",
                    "name": "",
                    "rules": [
                    {
                    "t": "set",
                    "p": "topic",
                    "pt": "msg",
                    "to": "east",
                    "tot": "str"
                    },
                    {
                    "t": "set",
                    "p": "payload",
                    "pt": "msg",
                    "to": "payload.value",
                    "tot": "msg"
                    }
                    ],
                    "action": "",
                    "property": "",
                    "from": "",
                    "to": "",
                    "reg": false,
                    "x": 440,
                    "y": 280,
                    "wires": [
                    [
                    "aa50dfeb.a2aac8",
                    "fc7cc2d3.d2d33"
                    ]
                    ]
                    },
                    {
                    "id": "a4346740.99dad",
                    "type": "change",
                    "z": "94606e09.7a27f",
                    "name": "",
                    "rules": [
                    {
                    "t": "set",
                    "p": "topic",
                    "pt": "msg",
                    "to": "nook",
                    "tot": "str"
                    },
                    {
                    "t": "set",
                    "p": "payload",
                    "pt": "msg",
                    "to": "payload.value",
                    "tot": "msg"
                    }
                    ],
                    "action": "",
                    "property": "",
                    "from": "",
                    "to": "",
                    "reg": false,
                    "x": 440,
                    "y": 340,
                    "wires": [
                    [
                    "aa50dfeb.a2aac8",
                    "4b75d3f.7025f2c"
                    ]
                    ]
                    },
                    {
                    "id": "ca6f8f7e.694db",
                    "type": "change",
                    "z": "94606e09.7a27f",
                    "name": "",
                    "rules": [
                    {
                    "t": "set",
                    "p": "topic",
                    "pt": "msg",
                    "to": "north",
                    "tot": "str"
                    },
                    {
                    "t": "set",
                    "p": "payload",
                    "pt": "msg",
                    "to": "payload.value",
                    "tot": "str"
                    }
                    ],
                    "action": "",
                    "property": "",
                    "from": "",
                    "to": "",
                    "reg": false,
                    "x": 440,
                    "y": 400,
                    "wires": [
                    [
                    "aa50dfeb.a2aac8",
                    "95fb4ebf.849778"
                    ]
                    ]
                    },
                    {
                    "id": "c51bb256.988678",
                    "type": "hs-device",
                    "z": "94606e09.7a27f",
                    "name": "Kitchen Sliding",
                    "device": "1225",
                    "server": "1bd28fbf.5b421",
                    "feature": "1230",
                    "reportonstartup": false,
                    "x": 300,
                    "y": 220,
                    "wires": [
                    [
                    "51036be6.501e2c"
                    ]
                    ]
                    },
                    {
                    "id": "bec0ebfa.60242",
                    "type": "hs-device",
                    "z": "94606e09.7a27f",
                    "name": "Kitchen window",
                    "device": "1225",
                    "server": "1bd28fbf.5b421",
                    "feature": "1233",
                    "reportonstartup": false,
                    "x": 300,
                    "y": 160,
                    "wires": [
                    [
                    "743c2437.11d7c4"
                    ]
                    ]
                    },
                    {
                    "id": "51036be6.501e2c",
                    "type": "change",
                    "z": "94606e09.7a27f",
                    "name": "",
                    "rules": [
                    {
                    "t": "set",
                    "p": "topic",
                    "pt": "msg",
                    "to": "kitchen sliding",
                    "tot": "str"
                    },
                    {
                    "t": "set",
                    "p": "payload",
                    "pt": "msg",
                    "to": "payload.value",
                    "tot": "msg"
                    }
                    ],
                    "action": "",
                    "property": "",
                    "from": "",
                    "to": "",
                    "reg": false,
                    "x": 480,
                    "y": 220,
                    "wires": [
                    [
                    "aa50dfeb.a2aac8",
                    "46beff62.16b728"
                    ]
                    ]
                    },
                    {
                    "id": "743c2437.11d7c4",
                    "type": "change",
                    "z": "94606e09.7a27f",
                    "name": "",
                    "rules": [
                    {
                    "t": "set",
                    "p": "topic",
                    "pt": "msg",
                    "to": "kitchen window",
                    "tot": "str"
                    },
                    {
                    "t": "set",
                    "p": "payload",
                    "pt": "msg",
                    "to": "payload.value",
                    "tot": "msg"
                    }
                    ],
                    "action": "",
                    "property": "",
                    "from": "",
                    "to": "",
                    "reg": false,
                    "x": 480,
                    "y": 160,
                    "wires": [
                    [
                    "aa50dfeb.a2aac8",
                    "a738b7cb.4ba37"
                    ]
                    ]
                    },
                    {
                    "id": "394841cc.96349e",
                    "type": "hs-device",
                    "z": "94606e09.7a27f",
                    "name": "Virtual TV TV and Kitchen zone status Zone status",
                    "device": "1295",
                    "server": "1bd28fbf.5b421",
                    "feature": "1296",
                    "reportonstartup": false,
                    "x": 970,
                    "y": 600,
                    "wires": [
                    []
                    ]
                    },
                    {
                    "id": "1a5e716e.cc3edf",
                    "type": "change",
                    "z": "94606e09.7a27f",
                    "name": "",
                    "rules": [
                    {
                    "t": "set",
                    "p": "topic",
                    "pt": "msg",
                    "to": "control",
                    "tot": "str"
                    },
                    {
                    "t": "delete",
                    "p": "payload",
                    "pt": "msg"
                    },
                    {
                    "t": "set",
                    "p": "payload.value",
                    "pt": "msg",
                    "to": "100",
                    "tot": "num"
                    },
                    {
                    "t": "set",
                    "p": "payload.status",
                    "pt": "msg",
                    "to": "open",
                    "tot": "str"
                    }
                    ],
                    "action": "",
                    "property": "",
                    "from": "",
                    "to": "",
                    "reg": false,
                    "x": 500,
                    "y": 600,
                    "wires": [
                    [
                    "275b2d4b.606da2"
                    ]
                    ]
                    },
                    {
                    "id": "a738b7cb.4ba37",
                    "type": "InvertUltimate",
                    "z": "94606e09.7a27f",
                    "name": "Invert",
                    "x": 670,
                    "y": 160,
                    "wires": [
                    [
                    "33268db3.470ba2"
                    ]
                    ]
                    },
                    {
                    "id": "46beff62.16b728",
                    "type": "InvertUltimate",
                    "z": "94606e09.7a27f",
                    "name": "Invert",
                    "x": 670,
                    "y": 220,
                    "wires": [
                    [
                    "33268db3.470ba2"
                    ]
                    ]
                    },
                    {
                    "id": "fc7cc2d3.d2d33",
                    "type": "InvertUltimate",
                    "z": "94606e09.7a27f",
                    "name": "Invert",
                    "x": 670,
                    "y": 280,
                    "wires": [
                    [
                    "33268db3.470ba2"
                    ]
                    ]
                    },
                    {
                    "id": "4b75d3f.7025f2c",
                    "type": "InvertUltimate",
                    "z": "94606e09.7a27f",
                    "name": "Invert",
                    "x": 671,
                    "y": 339,
                    "wires": [
                    [
                    "33268db3.470ba2"
                    ]
                    ]
                    },
                    {
                    "id": "95fb4ebf.849778",
                    "type": "InvertUltimate",
                    "z": "94606e09.7a27f",
                    "name": "Invert",
                    "x": 670,
                    "y": 400,
                    "wires": [
                    [
                    "33268db3.470ba2"
                    ]
                    ]
                    },
                    {
                    "id": "33268db3.470ba2",
                    "type": "BooleanLogicUltimate",
                    "z": "94606e09.7a27f",
                    "name": "Any zone open?",
                    "filtertrue": "onlytrue",
                    "persist": false,
                    "sInitializeWith": "WaitForPayload",
                    "triggertopic": "trigger",
                    "outputtriggeredby": "all",
                    "inputCount": "5",
                    "topic": "result",
                    "x": 900,
                    "y": 280,
                    "wires": [
                    [
                    "be486a1a.eac4c8"
                    ],
                    [],
                    []
                    ]
                    },
                    {
                    "id": "be486a1a.eac4c8",
                    "type": "change",
                    "z": "94606e09.7a27f",
                    "name": "",
                    "rules": [
                    {
                    "t": "set",
                    "p": "topic",
                    "pt": "msg",
                    "to": "control",
                    "tot": "str"
                    },
                    {
                    "t": "delete",
                    "p": "payload",
                    "pt": "msg"
                    },
                    {
                    "t": "set",
                    "p": "payload.value",
                    "pt": "msg",
                    "to": "0",
                    "tot": "num"
                    },
                    {
                    "t": "set",
                    "p": "payload.status",
                    "pt": "msg",
                    "to": "closed",
                    "tot": "str"
                    }
                    ],
                    "action": "",
                    "property": "",
                    "from": "",
                    "to": "",
                    "reg": false,
                    "x": 900,
                    "y": 380,
                    "wires": [
                    [
                    "275b2d4b.606da2"
                    ]
                    ]
                    },
                    {
                    "id": "275b2d4b.606da2",
                    "type": "rbe",
                    "z": "94606e09.7a27f",
                    "name": "",
                    "func": "rbe",
                    "gap": "",
                    "start": "",
                    "inout": "out",
                    "property": "payload",
                    "x": 710,
                    "y": 600,
                    "wires": [
                    [
                    "394841cc.96349e"
                    ]
                    ]
                    },
                    {
                    "id": "1bd28fbf.5b421",
                    "type": "hs-server",
                    "z": "",
                    "name": "HS4-Closter",
                    "host": "localhost",
                    "port": "80"
                    }
                    ]

                    Comment

                    Working...
                    X