Announcement

Collapse
No announcement yet.

Notify HS4 of WiFi device appearance

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

    #16
    Originally posted by Thedude View Post
    I can poll the Unifi controller now and obtain a long JSON with information of all APs and ALL devices on the network. I can send this info to HS4 and process it with Big6 PI, that is very good at parsing JSON. Not happy with this though as it adds significant extra burden to HS4. I need to do that every few seconds so that device detection is close to real time.
    Perhaps I misunderstand but if you are using a Unifi console you can get this information near-realtime with the HS4 Unifi plugin.

    https://forums.homeseer.com/forum/hs...atus-explained
    stefxx

    Comment


      #17
      Originally posted by Thedude View Post
      Call me stupid but I can't find plug-in with name rccnm or RCCNM or Rccnm. How to find and install the damn thing?
      To add to what Jeff wrote, Jon00’s plug-ins are not in the updater. They need to be manually installed. Look at his forum here, there is a link to his website in his signature.

      HS4 Pro, 4.2.19.0 Windows 10 pro, Supermicro LP Xeon

      Comment


        #18

        It is confirmed now that Unifi plug-in by stefxx detects connect/disconnect almost instantaneously average 8 sec. to connect and 4 sec. to disconnect. Furthermore it provides information about the current AP that the device is connected to.

        This is in stark contradiction with the results reported by ksum that it takes 30-40 seconds using Node-Red approach. I don't think that Node-Red adds delay at all. It seems that the Node-Red Unifi node connects to different properties of the Unifi controller that are not updated that often.

        Comment


          #19
          Here with the syslog approch it is instant.
          I’m using an asus router that can send it’s log to a syslog server.

          Events writing to a log are instant. So no delay .

          Comment


            #20
            I did it with Node-Red. Needed to go through the learning curve but it was worth it and ended up well. It is reasonably fast about 10 sec. from a device connect/disconnect to activate HS4 event. Notably I did it without polling which was the major concern. Unifi controller does report internal events such as connect/disconnect among others so that polling is possible but not necessary in my case. Willing to share details if someone is interested.

            Happy Holidays,

            Thedude

            Comment


              #21
              Originally posted by Thedude View Post
              This is in stark contradiction with the results reported by ksum that it takes 30-40 seconds using Node-Red approach. I don't think that Node-Red adds delay at all. It seems that the Node-Red Unifi node connects to different properties of the Unifi controller that are not updated that often.
              Note that the slower response is a worse case I have seen when changing a client between my Guest and House WLAN. Normally it was faster. I was polling every 2 seconds then, if the Guest count changes, retrieving a list of all clients. I Split the message twice so that I have a message for each item attached the the network (client). I look for any on the guest network, and allow those to pass beyond the Switch node. Those messages are modified to set msg.payload to be formatted for the line in the email body which lists this client. I then have a timeout of 2 seconds to get all the guest clients before sending the email. I JUST sped up the Join by making a change to the split data and no longer waiting for a timeout. This has sped up the results. So my initial inefficiencies are likely from how I was handling the split message. This really didn't matter to my needs and was done in haste to test my Google speakers apparently connecting randomly to my guest network.

              This is what my flow looks like. The only difference from the recent edit to improve the Split/Join portion is an added change to the Change node prior to the Join node:
              Click image for larger version

Name:	HS1.png
Views:	136
Size:	88.2 KB
ID:	1518187



              I am sure this is all complicated and am willing to expand on this if desired.

              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


                #22
                Note that device connect is quite quickly reported by Unifi. Disconnect will depend on a lot of variables. For instance, if you shut down a client device properly, or disconnect from WiFi, it should properly disconnect from the network which makes it almost instant. However, if a device is getting out of range slowly, it might take up to 10 minutes before Unifi reports it as offline. All that time the device is not able to communicate to the network, and thus offline.

                The Unifi plugin uses Web Sockets, so all information is "pushed" to the plugin as soon as it becomes available. But polling - assuming it is done frequently enough - should not add that much, and especially on disconnect it will probably be negligible considering all other variables. And I do not have any experience with Node-Red, but I don't believe that will add any noticeable delay either.
                stefxx

                Comment


                  #23
                  stefxx You did a great job with your plug-in and will consider it if I'm to get serious about tracking of multiple devices. My current task at hand is quite small tracking the arrival of one car and my Node-Red implementation is good enough.

                  ksum There is another node called "UnifiEvents" that doesn't require polling as it reports instantaneously events that happen on the Unify network. Give it a try without any filtering and you'll see all of the information that it reports. After you know that than you design your own filter(s) to pick the info that you need and pass to HomeSeer. I'm using Big6 plug-in at HS4 to process the incoming information. While Big6 has good JSON parsing why bother. I designed the filters at Node-Red so that HS4 and Big6 have very little work to do. At Node-Red I'm doing it with 3 "switch" nodes that act as filters. See attached flowchart.

                  Click image for larger version

Name:	Screenshot (477).png
Views:	160
Size:	83.4 KB
ID:	1518245

                  Comment


                    #24
                    I have not been able to get the UnifiEvents contrib to work with my Dream Machine Pro (UDMP) but I did see that there is a newer contrib called node-red-contrib-unifi-os which I was able to get to work and get events sent to Node-RED. It sends a LOT of events with various information. Interestingly the same happens when you are viewing the device's web pages. You can see them all through the Developer Tools in the web browser. I could use that contrib and filter through but finding the correct message, but . Ideally I would find an Endpoint I could use to only return the needed events.

                    Below is the CPU and Memory load on my UDMP. I have seen the CPU usage stay above 45% while using my polling method (every 2 seconds) at times, but it never reached 50%. The chart below has my flow in the earlier post running as well as a test flow which just gets the websocket data.

                    As for the delay in devices going "off line" when going out of range, maybe the latest_assoc_time or one of the last_seen/last_seen_by... variables could be helpful? No idea and I am far from an expert on the data available from the Unifi API.

                    Thedude Why not just use Node-RED to change a HomeSeer device directly?
                    Click image for larger version

Name:	HS1.png
Views:	151
Size:	41.0 KB
ID:	1518652

                    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

                    Working...
                    X