Add support for Hubspace by Afero

Ok giving that a shot, will post debug when complete. One suggestion that might assist in troubleshooting is the ability to reload hubspace without having to reboot the entire Hass system. This way tweaks can be made and adjusted and tested without having to do a full system reboot every time to test. Will report back shortly with findings.

Ok here’s the take always using the latest light.py.

  • The light is working now. However it does not present the full feature set. Looks like it’s not reporting the correct feature set so no ability to set colors or tempratures.
supported_color_modes:
  - brightness
model: 52133, 37833
deviceId: 81bbf008d1e3dcea
devbranch: false
debugInfo: null
icon: mdi:ceiling-fan-light
friendly_name: Dads Ceiling Fan Light
supported_features: 0
  • Light doesn’t turn on or off 100% of the time. Sometimes it just ignores the on / off call. I found that it you adjust the brightness then it perks back to life and responds again.

  • Fan does not stay on and no way to shut it off. When you click on the fan, the fan will turn on. Brightness sets the speed. The on/off seems to be working as a toggle and not an on / off. The behavior is the same in both the “fan” config and the entity that is created by hubspace.

  • Boot up still reporting same Log issue. Looks like it keeps trying to recreate the same entity.

Logger: homeassistant.components.light
Source: helpers/entity_platform.py:536
Integration: Light (documentation, issues)
First occurred: 11:46:10 AM (2 occurrences)
Last logged: 11:46:10 AM

Platform hubspace does not generate unique IDs. ID ce7e8811-697a-4872-9c7d-0a97e5b4b608_fan already exists - ignoring light.dads_ceiling_fan
Platform hubspace does not generate unique IDs. ID ce7e8811-697a-4872-9c7d-0a97e5b4b608 already exists - ignoring light.dads_ceiling_light

Definitely a step in the right direction!

Also just for reference.

Better than before! I did not think that light has rgb color. Color temp should be supported, but perhaps it broke. That light is funky as it only allows 6 color temps, not continuous like most other lights.

Try setting the friendlyname of the device (Dads_Ceiling) in the yaml config. If you are using automatic scanning (which someone else added), it may not be fully working and causing some issues. If you are specifying light name in the yaml, try the automatic instead.

Homeassistant has no capability to make code changes without restarting.

Here is the entry in my lights.yaml config. It is being found automatically.

  - platform: hubspace
    username: !secret hubspace_un
    password: !secret hubspace_pw
    friendlynames:
      - 'Dads_Ceiling'
    roomnames:
      - 'Dads Room'

So based on this I would assume it’s being added automatically. What I wonder is if there is an issue with the discovery and the error I posted earlier about the uuid’s?

No, this means you are specifying it. Remove the roomnames: key as you only need one way of adding it. See if that is better. If that does not work, remove the freindlyname: key

So try:

- platform: hubspace
    username: !secret hubspace_un
    password: !secret hubspace_pw
    friendlynames:
      - 'Dads_Ceiling'

then

- platform: hubspace
    username: !secret hubspace_un
    password: !secret hubspace_pw
1 Like

Winner winner chicken dinner! That did it. I removed both. Thank you for all the work on this. The light still only shows as a brightness light but I suspect its like you said because it’s a “hybrid” type. I’ll monkey with that on the side and see if I can’t work some Home Assistant trickery on it but otherwise I can say commit the new light.py it’s work as expected. The light is showing up correctly now and under brightness I can now set the temperature. This is functioning 100% now!

For anyone with the fan light combo like myself your config should look like this under your “lights” section. Do not specify room or fan name. There is also no need to add the “fan” template like the documentation says.

- platform: hubspace
    username: !secret hubspace_un
    password: !secret hubspace_pw
1 Like

I am fairly new to this… I believe I had loaded the files you created into my HA instance as directed. Are their edits we need to make outside of the config.yaml file where we insert the user/password/roomnames? I am finding it hard to verify that I’ve done it correctly. Should my lights show up as devices/entities?

I am trying to integrate my 16 11PR38120RGBWH1 into my HA setup. Thanks for helping the noob!

Nope, that is it. Just put the following in your config.yaml

light:
  - platform: hubspace
    username: your_hubspace_username (probably your email address)
    password: your_hubspace_password

I think for that model, you do not need to even enter the friendlynames or room names. It should find them automatically. You will have light.friendlyname where freindlyname is what you named it in the hubspace app (you’ll have 16 of them). If that doesn’t work, you’ll need to add the freindlynames 1 by 1 as it says in the readme. They should show up in Settings->Device and Integrations->Entities tab if you put hubspace in the search box.

Use HACS to install and restart homeassistant. You should see in the logs that hubspace custom integration is loaded, if you click “Load Full Logs”
2023-01-15 12:26:03.415 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration hubspace which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant

1 Like

Has anyone had success with Locks? Im having a lot of issues with them not updating their state in the home assistant, being slow on state change commands, not working in automations, etc

Locks were hacked in as a “light”, but the reversed engineered API may not perfectly replicate how the app works especially since I do not have one. Changing the lock state from HA should be instant, but it will take 30+ seconds for a lock change to be noticed by HA (lights work the same way). Also, the Wifi is only to the outlet they provide, then the outlet sends a command via BT to the lock. Feel free to play with the code to make improvements.

Related to this, I’ve run across an issue presenting as:

Platform error light.hubspace - cannot import name 'HubSpace' from 'custom_components.hubspace.hubspace' (/config/custom_components/hubspace/hubspace/__init__.py)

my config.YAML is:

image

I’m not sure what I’m doing wrong here, but I can’t even get past a check config.

the - should be aligned under the g in light, not the i. Also restart home assistant before doing to config check.

also, the code should be in /config/custom_components/hubspace/ you have an extra /hubspace. recommend using HACS to install to avoid this second issue.

1 Like

Hello,

I have added this to configuration.yaml after adding Hubspace integration via HACS and restarting homeassistant

 light:
   - platform: hubspace
     username: secret!
     password: secret!
 2023-01-28 20:44:32.736 ERROR (MainThread) [homeassistant.components.light] Error while setting up hubspace platform for light
  Traceback (most recent call last):
    File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 289, in _async_setup_platform
      await asyncio.shield(task)
    File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
      result = self.fn(*self.args, **self.kwargs)
    File "/config/custom_components/hubspace/light.py", line 109, in setup_platform
      hs = HubSpace(username,password)
    File "/config/custom_components/hubspace/hubspace.py", line 28, in __init__
      self._refresh_token = self.getRefreshCode()
    File "/config/custom_components/hubspace/hubspace.py", line 89, in getRefreshCode
      session_state = re.search('session_state=(.+?)&code', location).group(1)
    File "/usr/local/lib/python3.10/re.py", line 200, in search
      return _compile(pattern, flags).search(string)
  TypeError: expected string or bytes-like object

Now this is what i see in home-assistant.log

I have tried reinstalling and still no luck. Anyone see anything that stands out as a glaring issue?

Looks like your username/password are wrong, there is not good errror checking in the code. Are you putting your user and password in and just replaced it in what you posted? That is not the right syntax for secrets https://www.home-assistant.io/docs/configuration/secrets/

I had this integration working for a bit, but have now removed most of the yaml, assuming auto discovery should work, but now my device never shows up.
I have a Ceiling Fan/Light from Home Depot.
Is there anything specific I should be doing for it to be found? It’s the only hubspace device in my account. My credentials in the yaml are correct.

1 Like

I would just put the friendly name back. The auto discovery is not 100% robust. It was added with a PR, so I don’t really understand how it works!

I have the same issue with an HPPA11AWB outlet.
Originally, nothing showed up until I reset the password in the Hubspace app.
Now I only get an entity, but not a device.

light:

  • platform: hubspace
    username: !secret hubspacename
    password: !secret hubspacepass
    debug: false
    friendlynames:
    • ‘SegwayPower’

You never get a device. It only makes an entity.

Hi all,

I’m working on a standalone python library to try to simplify some of the device handling. I currently have good support for fans, lights and outlets, and I’m working on adding the other device types. The end goal is to make it so the integration might eventually become official, but also doesn’t have to solve each Hubspace problem from scratch.

While I had a fan/light combo, and bought an extra bulb and plugs to test, I don’t have a practical way to get/test/integrate other devices. As such, with @jaaem/jdeath’s encouragement, I’m posting in here for a bit of help.

Primarily, I need help with integration info for other device types, especially locks and transformers (though other random models are useful).

As such, if anyone who has basic Git/Python experience can help gather data, please:

  1. Pull the source code for the main branch of the repo at shawngmc/hubspace-ng: A python package to interface with the Afero Hubspace service for smart home devices (github.com)
  2. Run pip install --editable . to install dependencies
  3. Copy creds.json.template to creds.json and insert your username/password in the new file.
  4. Run python3 tools.py survey -a survey.zip to generate an anonymized report.
  5. (Optional but recommended) Open the zip file and make sure there is no data you consider sensitive. ‘-a’ attempts to anonymize the data, removing geolocation data, wifi and bluetooth info, and device ids, but it may miss info on odd devices.
  6. Open a ticket in the git repo titled ‘Survey from (USERNAME)’ and attach the zip file.

I’ll take a look at these and either close the ticket (as I suspect they’ll be supported properly) or branch it into other tickets.

Thanks in advance!

i am following the steps in GitHub - shawngmc/Hubspace-Homeassistant

In the hubspace app i have set the following details.

Model = 52133, 37833
Device Type = Ceiling Fan
Device Name = GuestOfficeFan
Fan Name = CeilingFan
Light Name = CeilingLight
Room = GuestRoom

in configuration.yaml i added

#Hubspace Fan
light:
  - platform: hubspace
    username: <email [email protected]>
    password: <password>
    debug: true
    friendlynames:
      - 'GuestOfficeFan'
    roomnames:
      - 'GuestRoom'
fan:
  - platform: hubspace
    fans:
      guestroom_fan:
        friendly_name: "CeilingFan"
        value_template: "{{ states('light.ceilingfan_fan') }}"
        percentage_template: "{{ (state_attr('light.ceilingfan_fan', 'brightness') / 255 * 100) | int }}"
        turn_on:
          service: homeassistant.turn_on
          entity_id: light.ceilingfan_fan
        turn_off:
          service: homeassistant.turn_off
          entity_id: light.ceilingfan_fan
        set_percentage:
          service: light.turn_on
          entity_id: light.ceilingfan_fan
          data_template:
            brightness: "{{ ( percentage / 100 * 255) | int }}"
        speed_count: 4

Upon checking configuration, i am getting

Invalid config for [fan.hubspace]: [fans] is an invalid option for [fan.hubspace]. Check: fan.hubspace->fans. (See ?, line ?).