Add support for Hubspace by Afero

After some tinkering - I think I got it. I removed the ‘’ around the friendly name. Working like a charm.

I was able to get your integration working for a 2 plug outlet and an RGB string light that was not already on your list simply by adding their model numbers in. For the Outlets though, it might be possible for your if statements to trigger off of the ‘deviceClass’ instead of the model number as my outlet showed up as a ‘power-outlet’. That way all outlets should setup without needing the model number first. As for my RGB lights string, the model number is ‘HPPA52CWBA023’ if you want to include it in future updates.

I really appreciate you getting this put together!!

First, thank you all to those who have worked on this. Second, I am completely new to Home Assistant, but I have the configuration working, but for the life of me I can’t figure out how to add the integration. I’ve looked through HACS and all through HA and simply can’t find it. Like I said, I’ve added the lines to the configuration file as well as the files to the correct directories. No errors in HA. Please help! Thanks!

2 Likes

Same situation here, except when I added the lines to configuration.yaml file and clicked Developer Tools/Check Configuration I got an error message:

Configuration invalid!
Platform error light.hubspace - Integration ‘hubspace’ not found.

Please help!

1 Like

How have you been using the config within HA? I haven’t been able to find out how to actually access the integration. Any help is appreciated!

This has worked great for me

I’ll add your RGB model. There probably is a much better way to add things, but I went with simple. I’ll look into using the device class. What is the outlet model?
Please try the latest light.py in the repo. If it works for your light and power outlet, I’ll push an update.

Trying jdeath integration again…getting a header error…any ideas?

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 493, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 703, in async_device_update
    await 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 509, in update
    self._debugInfo = self._hs.getDebugInfo(self._childId)
  File "/config/custom_components/hubspace/hubspace.py", line 331, in getDebugInfo
    r = requests.get(auth_url, data=auth_data, headers=auth_header)
NameError: name 'auth_header' is not defined

Yup you found a bug. I PM’d you a fix. Try that and I’ll make a new release once we solve your issue

1 Like

I have a fan, model “52133, 37833”, that I’m trying to get set up but I’m not sure which friendly name I should be using … should I be adding two entries, one each for the ceiling fan and ceiling light? Or should I be using the main name of the device?

For instance, in my case the main device friendly name is SuiteFan, and the child devices Ceiling_Fan and Ceiling_Light.

When I use SuiteFan as the friendlyName, I get this error in the log:

2022-09-24 00:16:00.642 ERROR (MainThread) [homeassistant.components.light] hubspace: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 493, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 703, in async_device_update
    await 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 301, in update
    self._brightness = _brightness_to_hass(self._hs.getState(self._childId,"brightness"))
  File "/config/custom_components/hubspace/light.py", line 40, in _brightness_to_hass
    return int(value) * 255 // 100
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'

I tried replacing SuiteFan with the two child names, but that didn’t seem to work either. Help?

Only pass in one. I may have to let people with the fan chime in. I believe it should be ‘SuiteFan’. The integration should make SuiteFan_fan and SuiteFan_light entities for you. Maybe try "SuiteFan’ or “SuiteFan”

If that does not work, pass only one of the child names, like ‘Ceiling_Fan’ then it should make Ceiling_Fan_light and Ceiling_Fan_fan for you.

If that doesn’t work, enable debug and PM me your logs.

I get those too. I know I’m supposed to pass in only one device but it didn’t give me both the light and fan. This is how I set up the integration, it works. I’ll figure the errors out at a later time.

#hubspace integration by jdeth https://github.com/jdeath/Hubspace-Homeassistant
light:
  - platform: hubspace
    username: ! secret hubspce_un
    password: !secret hubspace_pw
    debug: true
    friendlynames:
      - 'Fan'
      - 'Light'
### makes fan entity from hubspace integration
fan: !include fan.yaml

fan.yaml:
  - platform: template
    fans:
      office_fan:
        friendly_name: "Office Ceiling Fan"
        value_template: "{{ states('light.ceilinglight_fan') }}"
        percentage_template: >
          {{ (state_attr('light.ceilinglight_fan', 'brightness') / 255 * 100) | int }}
        turn_on:
          service: homeassistant.turn_on
          entity_id: light.ceilinglight_fan
        turn_off:
          service: homeassistant.turn_off
          entity_id: light.ceilinglight_fan
        set_percentage:
          service: light.turn_on
          entity_id: light.ceilinglight_fan
          data_template:
            brightness: >
              {{ ( percentage / 100 * 255) | int }} 
        speed_count: 3 

Your template has light.ceilinglight_fan, so you must be passing in ceilinglight, but your friendlynames are ‘Fan’ and ‘Light’ Weird, not sure why it works but glad it does!

Hey all, I’ve been working on getting this integration working with my setup for a bit. I finally got it somewhat working but hoping someone can give me some guidance on pulling the full functionality out of this.

I’ve got 2 ceiling fans. both model 52133, 37833. Initially I was able to get on of the fans to connect but none of the controls were working. I’d try to turn on the fan from my dashboard and the dashboard switch would just sit for a bit before flipping off.

Today I tried again and I actually got some of the devices working. One device has pulled in both the fan and light entity, and they both actually function (though not fully). However, the other device only brought in the light component, not the fan. Which is weird. Both devices are setup identically other than the names being different obviously.

As far as the working entities go, I don’t have color temperature control (these lights have 6 different temp settings). On/Off and brightness work fine. And on the fan entity, it works but obviously the dimmer has a resolution of 0-100 whereas the fixture only has 4 speed settings. So the speeds are 25%, 50%, 75% and 100%. Not a huge deal, but would be nice to have a slider that snaps to those 4 settings. As well as having the “Comfort Breeze” option and timer settings.

I tried to setup a template like JimBr0 laid out but was getting compile errors, and I’m not familiar enough with this workflow to troubleshoot at the moment.

Any guidance would be much appreciated and I can help with providing logs quickly if you need.

That fan is the bane of my existence. It works for some, but not others. Not sure why. Internally, it does snap to those fan values, based on what you input. I hacked it to emulate a light, so I don’t think it can do a comfort setting. It is probably time for a real coder to step in and make a true integration that has real light and fan entities.

I feel ya. I know just enough about coding to be able to read code and generally understand what’s going on, but I have no idea where I would start coding something like this.

Digging a bit and it looks like my issue with the one fan not showing up is because of the first time I tried setting up this integration. The logs show an error about an id already existing. It’s the one entity I tried to connect the first time, but I haven’t been able to figure out how to delete the old entity. It doesn’t show up in the entity list so who knows.

The comfort breeze thing isn’t that important to me. The color temperature thing is something I’d love to figure out.

Very appreciative of all the work you’ve done on this. I’m going to dig some more about this rogue entity and if I get that figured out I’ll work to see if there’s anything I can do to help this integration.

I just updated to the most recent release. I have 2 different models of dual outlets and wanted to spend a little time to get them added to my Hass. I had previously put in names of both the dual outlet and of each output on the dual outlets, spent some time changing commented lines to find out that only the names of the entire outlet let hubspace load without errors. All of my single plug outlets are showing up as having 2 outlets. I’m not in a room where any plugs are to see how they react.

The error I had been getting referred to line 100 of light.py referencing device model.

How should I be defining these dual outlet plugs and single plug devices in the config?

I just looked in entities and on the info of one of my single plug devices returned “This entity is no longer being provided by the hubspace integration. If the entity is no longer in use, delete it in settings.”

both outlet_1 and outlet_2 of that same plug do appear.

I’ll come back to this in a bit to dig further.

I was able to get both of my fans working. The rogue entity was disabled for some reason. Once I found that, I was able to delete it and get all the entities loaded and working!

I’ll see if there’s any help I can provide in getting all the settings to load in.

The dual outlet does work individually now but the single plugs dont respond. I do have debug enabled but see i can change error level for logs. Ill update again in a bit

The integration is setup to handle the number of outlets automatically for you. You pass in a single friendlyname and it makes light.friendlyname_outlet1 and light.friendlyname_outlet2 automatically. Long and short: single freindlyname for each physical device.

I did not know there was a single outlet model. If so, please send me the model number string and I can make it handle it correctly. I may need the debug logs to handle the field correctly

1 Like