Announcement

Collapse
No announcement yet.

Hubspace Integration

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

    Hubspace Integration

    This is a continuation of thread started at https://forums.homeseer.com/forum/ho...bspace-support. It contains the specific implementation for the subject integration as part of mcsMQTT. Section of mcsMQTT user manual is copied below.

    Initial version is 6.2.0.0 that can be obtained as a delta set of file from Updater 6.x.x.x or as an Updater package that contains the full install using Updater Override process. See bottom of https://forums.homeseer.com/forum/hs...ge-log-hs4-hs3 for install files.


    Hubspace is a brand that shares a common smartphone App for outlets, locks, lights, fans and other products distributed through Home Depot. A snapshot from the HD marketing page is shown in Figure 117.
    Click image for larger version  Name:	dataurl105446.png Views:	0 Size:	130.9 KB ID:	1596604
    Figure 117 Hubspace Products
    The products are setup by first creating a Hubspace account and using the QR codes provided with each instance of the product that is being installed. Bluetooth is used for initial setup of the product to gain access to the WiFi network and then WiFi is used to communicate with the Hubspace cloud server.
    A Python library is available with instructions and repository at https://github.com/jan-leila/hubspace-py and https://pypi.org/project/paho-mqtt/#installation It is most easily installed from the command line / terminal window using PIP with the command
    pip install hubspace
    pop install paho-mqtt
    If Python3 and PIP are not yet installed on the Homeseer computer they first need to be installed. Use Google for guidance on installing them on the OS that is hosting Homeseer. After installation, the folder where python.exe needs to be identified as it varies. There will also be a \Scripts subfolder that normally a subfolder of where python.exe is located. HubspaceRequest.py will be copied to the \Scripts subfolder.
    During installation of Python, the PATH environment variable is normally updated with path to python and the scripts subfolder. It will likely be necessary to have these definitions in PATH.
    The integration of this library with Homeseer is done with the Python script HubspaceRequest.py that is available in the mcsMQTT download package and originally installed at subfolder \bin\mcsMQTT. It will not be run from this location, but is moved to the \Scripts subfolder of python install.

    The mcsMQTT setup for Hubspace integration is on the Cloud Page, Hubspace Tab as in Figure 118
    Note the full path to python.exe and the Scripts folder in the setup. Also needed are the email and password to the account that was setup with Hubspace. Data is polled for status updates to handle the local control being synced with HS. Provision is also provided to disconnect the connection with the cloud server. This disconnection will also result in the Python script HubspaceRequest.py being terminated. HubspacaceRequest.py is managed by mcsMQTT and run when the setup is complete and not disconnected.

    Click image for larger version  Name:	dataurl105442.png Views:	0 Size:	34.7 KB ID:	1596601
    Figure 118 Hubspace Integration Setup
    After everything is put in place it would be good to run HubspaceRequest.py from console/terminal window such as below after navigating to the Python \Scripts folder. In this example, 192.168.0.5 is the MQTT Broker address. If no MQTT Broker has been setup then use 127.0.0.1 here and on the mcsMQTT MQTT Page, General Tab. myEmail.com will be your Hubspace account email. myPW can be anything as this test will not have success with connection to the cloud server. The test is to assure all the Python components are installed correctly. If no error message on the console/terminal then likely the install is good.
    python hubspaceRequest.py myEmail.com myPW 192.168.0.5
    At this time the integration supports the outlet and lightbulb. Others can be added in the future with assistance from users of the other equipment. The mcsMQTT integration structure is setup to add additioinal products with minimum difficulty.
    mcsMQTT will use two endpoints with the Hubspace server. One provides Meta data that describes the characteristics of the product that exist on the account/server. The other provides the Attributes of the products which includes the current state.
    The data of interest is visible on the MQTT Page, Association Tab. This includes the Hubspace product attributes and message feedback in communicaitons between mcsMQTT and HubspaceRequest.py. The Meta data is not shown in this table. A slice of this is shown in Figure 119. Beyond the setup of HS Device Features other features of mcsMQTT, such as History data and charting, can be selected from this page.
    Click image for larger version  Name:	dataurl105445.png Views:	0 Size:	48.7 KB ID:	1596602
    Figure 119 Hubspace Product Data as MQTT pseudo-Topics
    The outlet is presented by the Hubspace server as two independent plugs. There is no single command to control both simultaneously, but the HS linking capability can be used if the desire is to have both plugs controlled together.
    A feature is provided by mcsMQTT to allow an outlet to be always ON. At each polling interval mcsMQTT will confirm it is ON and if not, it will command it to the ON state. The On/Off controls will still be visible on the HS Devices page, but can be removed if desired using the Status/Graphics Tab of the HS Devices Page.
    To indicate that an outlet plug is be always ON, the PubTopic on the Association Tab will be changed so that is indicates it is “on” rather than the actionId that is normally at the end. Using the examble of HS Feature 7823 shown in Figure 119, the Pub textbox will be changed
    From: Hubspace/HStest_toggle outlet-2_3_872d485519a9fcde/3
    To: Hubspace/HStest_toggle outlet-2_3_872d485519a9fcde/on

    HS Device and Features will be automatically created based upon the Meta data with example of outlet and light in Figure 120. The Feature names are taken from the Meta data. They can be changed by the user from the default names if desired. Renaming will not affect operation. Similarly, Floor, Room and Device/Feature grouping can all be changed using the Devices page tools provided by HS.

    Click image for larger version  Name:	dataurl105447.png Views:	0 Size:	153.0 KB ID:	1596603
    Figure 120 Hubspace Auto-Created HS Device and Features

    #2
    Thank you for the thorough documentation as to how to make this happen. Have download Python and PIP, etc Have the mcsMQTT​ plugin in HS, when I go to the Cloud tab, the Hubspace tab is not there though some of the others are as in the example, I think am I missing something where we get the Hubspace intergration into homeseer. I did the PIP install process of both items recommended so they may be here somewhere. I may need find and move them to scripts folder, have gotten kind of lost. Have tried to follow along careful, but please understand that for me this like "Pinning a black cat down in a dark room", whereas I am willing to learn, just do not have the background in these tools that its clear to me. I am sure that once setup properly I can learn the rest.. I think is the update overide process that may have me stumped.

    Comment


      #3
      What have you done to try to install the most recent version of the plugin?

      Two options available. One is by putting the full zip into HS root folder, extracting UpdaterOverride.json from it into the same, using HS plugins page, Add and the only option available for HS4 plugins is mcsMQTT. Select it and HS should respond with install success.

      The other is to take the delta zip. The two .html files go into HS subfolders \html\mcsMQTT and the others go into \bin\mcsMQTT. The HS version reported will not change in this case, but the delta version can be seen from the first header on the MQTT Page, General Tab of the plugin.

      The missing Hubspace tab means the updated Cloud.html has not made it into \html\mcsMQTT subfolder by either of the two processes described above.

      Comment


        #4
        The integration of the outlet was straightforward. Each of the two plugs can be controlled by the Hubspace smartphone app and status reflected in HS. HS can change the state of a plug and it is reflect in the App. Responsiveness was as expected with a polled cloud connection.

        The meta data for the outlet showed two states for the power and two states for the toggle. I used both at one time or another during development and they both seemed to have the same result. I ended up with toggle in the integration because its meta data was more complete and allow a more generalized implementation that would handle whatever device the meta data described.

        The color bulb was a different story. I may not know how to use the App for the bulb, but it should be intuitive. Once the bulb gets into a mode where color changes over time then I could not get it out of that mode from the App (or HS). The bulb at this point was pretty much on its own and the Cloud server did not sync with it. This means the HS integration was also not in sync. When I used the App to change brightness it would eventually (~15 minutes) be reflected in the cloud server/HS, but the bulb was still in its preset mode with color being changed.

        The meta data shows a bulb to have an action for color sequence preset and color sequence custom. This is what I mapped into two HS device features. The App combines these two as a single user selection. It is hard to know how to sync the App and HS in this area. Since the bulb is out of sync it is hard to know where "truth" is.

        The attribute reporting includes many more hardware endpoints than are disclosed in the meta data. In the HS integration I ignored anything that was not included in meta data. The additional ones could data that the manufacturer has interest, but the user does not. Don't know for certain.

        It continues to be clear that company providing the cloud server has a very generic capability and each manufacturer will use is as they desire. It is oriented to bit-mapped hardware implementations. For example to specify the color sequence then something like the following hexadecimal is provided 034700FF0000640A0000FF00640A00. For an outlet (or a bulb on/off control) is is still a hexadecimal value, but will be 00 vs. 01.

        Comment


          #5
          I tried the first method, copying zip file into home directory and UpdaterOverride.json also in Home directory, but the in HS plugin page has not changed even after restart.
          Can you possible make so that if I deleted and reinstalled the mcsMQTT from/in homeseer, it would give me that config screen for the hubspace, I understand the values and Paths it wants and could configure that part. Thank you also for further information on the bulbs...

          Comment


            #6
            Just use the other method from MCSMQTTHS4_6200.zip. Two files into one folder and the other files into the second folder. Start mcsMQTT plugin. This assumes you have previously installed the version available from the Updater.

            To give you what you ask I need to submit to HST for there evaluation and then upload to their server. I do not like to bother them since this plugin adds new functionality on a regular basis and their is no revenue for them from it. I also need user feedback before releasing new functionality via the Updater.

            Comment


              #7
              Understood, I will take another stab at it tomorrow, I think I am close, I see a light at the end of the tunnel...I have indeed installed the mcsMQTT plugin that is currently in HS plugin area.

              Comment


                #8
                I was playing more with the bulb and made some updates related to it. I uploaded to the same 6.2.0.0 version files, including the HubspaceRequest.py file. While you can use the original files, it is best to use what I now have to better support your integration.

                Comment


                  #9
                  Okay, I got the override to run, put all the paths and creds into the Hubspace tab on the cloud page, now I am stumped about here

                  "After everything is put in place it would be good to run HubspaceRequest.py from console/terminal window such as below after navigating to the Python \Scripts folder. In this example, 192.168.0.5 is the MQTT Broker address. If no MQTT Broker has been setup then use 127.0.0.1 here and on the mcsMQTT MQTT Page, General Tab. myEmail.com will be your Hubspace account email. myPW can be anything as this test will not have success with connection to the cloud server. The test is to assure all the Python components are installed correctly. If no error message on the console/terminal then likely the install is good. \python hubspaceRequest.py myEmail.com myPW 192.168.0.5​"

                  Where is the console terminal window? Am a little lost on the whole broker address part as well... I found the generaI and broker is the 127.0.0.1, so I may need to change that? Not sure I have a MQTT broker setop, probably not. think I am a step closer though, as I just completed the override this morning, hopefully I got your latest file. Thanks again.

                  Comment


                    #10
                    It is not necessary to test run HubspaceRequest.py, but if things do not work then it is a technique to try to isolate the failure. Most plugins do no use Python so this is not a common way to do integration with HS. I believe HomeAssistant does this regularly.

                    Make certain you have copied the HubspaceRequest.py file from the same zip you downloaded into the Python \Scripts folder. It is different than the first one and need to be the same version as the other plugin files.

                    The command or console window on Windows (Terminal window on Linux) can be viewed on Windows 10 or 11 by using Windows button on keyboard and entering cmd in the search text box. It will show the Command Prompt app that you can select. Use the DOS cd command to get to the Python \Scripts folder and then issue the command
                    Code:
                    python HubspaceRequest.py yourEmail xxx 192.168.0.5
                    where 192.168.0.5 is replaced by your HS IP; yourEmail by your Hubspace email account; xxx can be left as-is.

                    What I would do first is to go to the Hubspace Tab of the mcsMQTT Cloud Page and enter the information in the table. Wait a minute or two and open up Task Manager (ctl-alt-del followed by selection of Task Manager). Look at details tab and find row with task python.exe. If you do not see it then likely a problem with the Python parts of the setup. If present then you should see HS Device created in Room Hubspace and Floor Hubspace.

                    It is useful to have mcsMQTT MQTT Page, General Tab at the top with Debug checkbox enabled so information is placed in file \Data\mcsMQTT\mcsMQTT Debug.txt that can help with debug analysis.

                    Comment


                      #11
                      Command line prompt seems to execute the command did not return me to C prompt but did not error out, could see in task manager.

                      In HS have filled out hubspace tab. waited a few minutes, but then when going to taskman no Python there... (after closing command line occurence) Still no hubspace room or floor

                      Comment


                        #12
                        Provide the mcsMQTT Debug.txt file and we can see where we should go from there. If python is not in task manager then there likely is an issue with running python programatically.

                        From the command prompt, enter
                        Code:
                        PATH
                        When I did it I received the following and it can be seen toward the bottom that "C:\Python37-32\Scripts\;C:\Python37-32" are in my path. These values should be similar to what you have setup on the mcsMQTT Hubspace Tab. In my case python.exe is at C:\Python37-32\
                        Code:
                        C:\Users\Dell>path
                        PATH=C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\PuTTY\;C:\Program Files (x86)\Common Files\Acronis\SnapAPI\;C:\Program Files (x86)\Acronis\TrueImageHome\;C:\Program Files\LLVM\bin;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\Program Files\dotnet\;C:\Program Files\Microsoft VS Code\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Common Files\Acronis\VirtualFile\;C:\Program Files (x86)\Common Files\Acronis\VirtualFile64\;C:\Program Files\Amazon\AWSCLIV2\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\Microsoft SQL Server\150\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn\;C:\Program Files\Azure Data Studio\bin;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files\WIDCOMM\Bluetooth Software\;C:\Program Files\WIDCOMM\Bluetooth Software\syswow64;C:\Python37-32\Scripts\;C:\Python37-32\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\Microsoft VS Code\bin;C:\Users\Dell\AppData\Local\atom\bin;C:\Users\Dell\AppData\Roaming\npm;C:\Users\Dell\AppData\Local\Microsoft\WindowsApps;C:\Users\Dell\.dotnet\tools;;C:\Program Files\Azure Data Studio\bin
                        
                        C:\Users\Dell>​

                        Comment


                          #13
                          Have verified that both program and script folder are in path statement and identical in HS. i missed the part about the debug file, but have turned that on now..
                          Did you say that password was irrelevant really, so in theory if I had xxx in Huspace cloud tab, basically as long as I am using the correct email address for the account it should work??

                          ​I was able to retrieve this if it helps
                          Attached Files

                          Comment


                            #14
                            Looking at the Python code from GitHub the authentication looks to be similar to what is being used for NuHeat thermostat. I should be able to do the cloud access directly without having a need for Python for Hubspace as well. This has always been the hardest part of the integration of cloud services so having it already encapsulated in the Python library was the easiest way to get the functionality.

                            Comment


                              #15
                              Thank you. Its definitely not for the skwemish. I feel I have followed all the steps successfully, frustrating to not get anywhere. I keep fumbling at it.

                              Comment

                              Working...
                              X