Add support for Hubspace by Afero

Thanks @jaaem for figuring out the Auth component! I forked your repo which didn’t seem to work out of the box with the Hubspace ceiling fan, and updated it so that it can auto-populate entities and control brightness. I’m hoping to get around to making the FanEntity soon. There’s also lots of work that can be done to minimize the number of API calls being made (for both Auth and hopefully the entities).

2 Likes

Awesome. I will leave it in your capable hands! Those are great improvements. I think the auth token was only good for 120 seconds, so I was lazy and refreshed it every call. There is definitely a smarter way. And welcome to home assistant, not bad for first post!

1 Like

Super excited you guys are working on this. I bought the RGBW recessed lights, and was rather disappointed in how little integration they had with products. I was able to get @jaaem version working with on/off, but the lights only appeared in my dashboard. I was not able to get @mecolmg version to work at all. I tried doing manually and though HACS with no avail.
Is there any way to get these to show up as integrations? I would like to setup a dummy/add-on switch with an automation to turn the power on and off without actually killing the power to them so that they can still be used via voice or switch.
If there are anything I can test for you guys or assist with, I’m new to Home Assistant, but I’m excited to play.

1 Like

Glad my version works. It was not tested on your light. I also could not get mecolmg’s version to work. I am confused, if it shows up on the dashboard and works, you should be able to use it in an automation just fine. It is an integration, just configured via the yaml and not the integration page interface. It should make a light.xxxx entity, which you can automate. One note, turning off/on should be instant but if you turn off via voice it could take a minute for homeassistsnt to notice.

I’m really excited about the development of this integration as well!

I haven’t been able to get @mecolmg’s version working either. I have the recessed RGBW lights as well, and I’m looking forward to finally being able to control the color of them from home assistant.

Any traction on this? I just boght 1 light today and its not working with either github repo.

Since I have mine working, I was not planning on making updates. I do not have any other devices besides the PIR dimmer, so will need people to contribute. You can either DM me your user/password and I can try to figure out how to set the RGBW. Or if you have python, you can edit/run this script (Hubspace-Homeassistant/TestHubspace.py at 21eb2951791f662c55a0edb2d513e185e4744d92 · jdeath/Hubspace-Homeassistant · GitHub) and DM me the output. Be good if you run it with the lights in different states (Ie, red, blue, green, white only). No guarantee when I’ll get to it and testing will be hard without the device.

1 Like

Hmm, if i had to guess, it’s probably the combination of FunctionClass and FunctionInstance differs per-device. I’m making some changes now which will parse the function definitions we get from the API and use those to determine and update the state. I’ll update here once that’s working and checked-in.

Like @jaaem suggested though, I’m only able to test this with the Hubspace device I own (ceiling fan), so any output you can retrieve from his TestHubspace script would be very helpful in ensuring any changes will actually work for you. Keep in mind though, there is sensitive data which can be outputted by that script, so you may want to DM the output and/or scrub it before posting.

1 Like

Yes, no need to DM the refresh token (at top) or the IDs that go with the lights.

I did add brightness to my version of the integration, just for the PIR Switch, which I basically copied from mecolmg

FYI. Looks like we got enough to figure out RGBW

If your model supports RGBW, please post or DM me the model. This can be found from my script or from the latest version of my integration. It should show the model in the state attributes in the entity listed in developers tools.

I keep getting this error after I have downloaded the hubspace and put it into my config folder. I have added my hubspace username and password into configuration .yaml. Any help is appreciated.

Setup failed for custom integration hubspace: No setup or config entry setup function defined.

11:30:18 PM – (ERROR) setup.py

that error is from mecolmg’s version. I get the same error. Try my version and report back any issues.

I have the pot lights. The model number shown is “50291, 50292.” Keep up the great work.

I’ve added your integration through HACS, but I am not seeing my devices as entities.

I am getting an error as well. Newb here so still trying to work through it.

@jaaem any suggestions,

Logger: homeassistant.components.light
Source: custom_components/hubspace/hubspace.py:156
Integration: Light (documentation, issues)
First occurred: 2:46:02 PM (1 occurrences)
Last logged: 2:46:02 PM

Error while setting up hubspace platform for light
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 249, in _async_setup_platform
await asyncio.shield(task)
File “/usr/local/lib/python3.9/concurrent/futures/thread.py”, line 58, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/hubspace/light.py”, line 53, in setup_platform
entities = [HubspaceLight(username, password, friendlyname) for friendlyname in config.get(CONF_FRIENDLYNAMES)]
File “/config/custom_components/hubspace/light.py”, line 53, in
entities = [HubspaceLight(username, password, friendlyname) for friendlyname in config.get(CONF_FRIENDLYNAMES)]
File “/config/custom_components/hubspace/light.py”, line 80, in init
[self._childId, self._model] = hs.getChildId(self._refresh_token,self._accountId,self._name)
File “/config/custom_components/hubspace/hubspace.py”, line 156, in getChildId
model = lis.get(‘description’).get(‘device’).get(‘model’)
AttributeError: ‘NoneType’ object has no attribute ‘get’

Hmm. Not sure. Maybe pair down the list to just one light, maybe bathroom. Looks like it is login in, but getting tripped up on the name of one of your lights.

Also, if can run python, there is a test script in the GitHub, that will allow easier trouble shooting. Try running that if running just one light doest work.

Ok, so I went down to 1 light (switch), and still got the same error, I changed the “one item” between a few different switches, I get the error on most of them except ‘Laundry’. ‘Laundry’ doesn’t produce an error but it also does not show in the device list or on the dashboard…

maybe I’ll try starting over…

Hey all, I was able to get 2 of 8 device to load as Read-only Entities and that’s it. I don’t think that is how it’s supposed to work…

Please post the model numbers of the versions you go to work read only, let us start there. I found model ‘AL-TP-RGBCW-60-2116, AL-TP-RGBCW-60-2232’: need another field sent which the dev version does. Those might too.
Also, please try the DEV branch, as that has the latest fixes. Just go to Github, switch to dev, and download the light.py and hubspace.py.

Basically, if it is a model I don’t have, you may need to run the python script to do a dump, DM me the output, and I can try to figure out what is going on.

So I learned that you can’t have a Space in the Name. I update the Names and got these to Load as entities only and Read only.
Friendlynames - Model
-‘Guest_Bath’ - HPDA311CWB

  • ‘Girls_Bath’ - HPDA311CWB

  • ‘Laundry’ - HPDA311CWB

  • ‘Mud_Room’ - HPDA311CWB

  • ‘Master_Closet’ - HPDA311CWB

  • ‘Fireplace_Left’ - 50291, 50292

  • ‘Fireplace_Right’ - 50291, 50292

  • ‘Fireplace_Outlet’ - HPKA315CWB

  • ‘Master closet’ - Error Line 157 hubspace.py:157 UnboundLocalError: local variable ‘model’ referenced before assignment

  • ‘Mud Room’ - Error Line 156 hubspace.py:156 AttributeError: ‘NoneType’ object has no attribute ‘get’

Will try the dev branch now