Add support for Hubspace by Afero

My apologies for not creating a new issue for this request. Issue #87 opened and the log from TestHubspace.py attached to it.

I am having a issue and maybe I am missing something obvious. I have installed the integration from hacs. When I go to add integration in setting and select hubspace i get the message “ You can add this device by adding it to your ‘configuration.yaml’. See the documentation for more information.” in the documentation it seems to indicate that it should be seeing a prompt to enter username and password to access the api. Am I missing something?

We are about to make a new major release and the documentation is out of sync with HACS release. Standby for a new release in an hour or so. It is so much better!

1 Like

Just updated to Hubspace 3.0.
I have one light “538551010, 538561010, 538552010, 538562010
by Commercial Electric.”
It had been working fine with the previous release.
With the new release, on, off, and dim are working.
However, color changes result in errors like:
“Failed to call service light/turn_on. 500, message=‘Internal Server Error’, url=URL(‘https://api2.afero.net/v1/accounts/f4bd2419-f74b-4977-a6f8-32c65d807f54/metadevices/bce7759c-2955-4c27-ad81-6aa56aa80025/state’)”

The Hubspace app on Android is able to change colors.

In the log:

2024-08-01 10:43:21.187 INFO (MainThread) [custom_components.hubspace.light] Adjusting light bce7759c-2955-4c27-ad81-6aa56aa80025 with {'rgb_color': (255, 163, 232)}
2024-08-01 10:43:21.187 DEBUG (MainThread) [hubspace_async.connection] Update the device [bce7759c-2955-4c27-ad81-6aa56aa80025] with new states: [HubSpaceState(functionClass='power', value='on', lastUpdateTime=None, functionInstance=None), HubSpaceState(functionClass='color-rgb', value=(255, 163, 232), lastUpdateTime=None, functionInstance=None)]
2024-08-01 10:43:21.283 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [547442754176] Unexpected exception
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 241, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2731, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2774, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 999, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1071, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 628, in async_handle_light_on_service
    await light.async_turn_on(**filter_turn_on_params(light, params))
  File "/config/custom_components/hubspace/light.py", line 452, in async_turn_on
    await self._hs.set_device_states(self._child_id, states_to_set)
  File "/usr/local/lib/python3.12/site-packages/hubspace_async/connection.py", line 252, in set_device_states
    response.raise_for_status()
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 1070, in raise_for_status
    raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 400, message='Bad Request', url=URL('https://api2.afero.net/v1/accounts/f4bd2419-f74b-4977-a6f8-32c65d807f54/metadevices/bce7759c-2955-4c27-ad81-6aa56aa80025/state')
2024-08-01 10:43:21.428 INFO (MainThread) [custom_components.hubspace.light] Adjusting light bce7759c-2955-4c27-ad81-6aa56aa80025 with {'rgb_color': (224, 178, 255)}
2024-08-01 10:43:21.429 DEBUG (MainThread) [hubspace_async.connection] Update the device [bce7759c-2955-4c27-ad81-6aa56aa80025] with new states: [HubSpaceState(functionClass='power', value='on', lastUpdateTime=None, functionInstance=None), HubSpaceState(functionClass='color-rgb', value=(224, 178, 255), lastUpdateTime=None, functionInstance=None)]
2024-08-01 10:43:21.463 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [547442754176] Unexpected exception
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 241, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2731, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2774, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 999, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1071, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 628, in async_handle_light_on_service
    await light.async_turn_on(**filter_turn_on_params(light, params))
  File "/config/custom_components/hubspace/light.py", line 452, in async_turn_on
    await self._hs.set_device_states(self._child_id, states_to_set)
  File "/usr/local/lib/python3.12/site-packages/hubspace_async/connection.py", line 252, in set_device_states
    response.raise_for_status()
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 1070, in raise_for_status
    raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 400, message='Bad Request', url=URL('https://api2.afero.net/v1/accounts/f4bd2419-f74b-4977-a6f8-32c65d807f54/metadevices/bce7759c-2955-4c27-ad81-6aa56aa80025/state')
2024-08-01 10:43:21.692 INFO (MainThread) [custom_components.hubspace.light] Adjusting light bce7759c-2955-4c27-ad81-6aa56aa80025 with {'rgb_color': (224, 178, 255)}
2024-08-01 10:43:21.692 DEBUG (MainThread) [hubspace_async.connection] Update the device [bce7759c-2955-4c27-ad81-6aa56aa80025] with new states: [HubSpaceState(functionClass='power', value='on', lastUpdateTime=None, functionInstance=None), HubSpaceState(functionClass='color-rgb', value=(224, 178, 255), lastUpdateTime=None, functionInstance=None)]
2024-08-01 10:43:21.726 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [547442754176] Unexpected exception
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 241, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2731, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2774, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 999, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1071, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 628, in async_handle_light_on_service
    await light.async_turn_on(**filter_turn_on_params(light, params))
  File "/config/custom_components/hubspace/light.py", line 452, in async_turn_on
    await self._hs.set_device_states(self._child_id, states_to_set)
  File "/usr/local/lib/python3.12/site-packages/hubspace_async/connection.py", line 252, in set_device_states
    response.raise_for_status()
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 1070, in raise_for_status
    raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 400, message='Bad Request', url=URL('https://api2.afero.net/v1/accounts/f4bd2419-f74b-4977-a6f8-32c65d807f54/metadevices/bce7759c-2955-4c27-ad81-6aa56aa80025/state')
2024-08-01 10:43:25.503 DEBUG (MainThread) [hubspace_async.connection] Querying API for all data
2024-08-01 10:43:25.578 DEBUG (MainThread) [hubspace_async.connection] Adding a new home, 239e6d1c-9c2c-412e-965a-e45b52b21e4f
2024-08-01 10:43:25.578 DEBUG (MainThread) [hubspace_async.connection] Unable to process a result of type metadevice.home
2024-08-01 10:43:25.579 DEBUG (MainThread) [hubspace_async.connection] Adding a new room, 9df77b81-8e42-4e1a-8393-626504e735c1
2024-08-01 10:43:25.579 DEBUG (MainThread) [hubspace_async.connection] Adding a new device, bce7759c-2955-4c27-ad81-6aa56aa80025
2024-08-01 10:43:25.580 DEBUG (MainThread) [custom_components.hubspace.discovery] Performing auto discovery
2024-08-01 10:43:25.580 INFO (MainThread) [custom_components.hubspace.discovery] Performing discovery for the following friendly names: Basement office ceiling
2024-08-01 10:43:25.587 DEBUG (MainThread) [custom_components.hubspace.coordinator] Writing out anonymized device data to /config/custom_components/hubspace/_dump_hs_devices.json
2024-08-01 10:43:26.557 DEBUG (MainThread) [custom_components.hubspace.coordinator] Writing out raw device data to /config/custom_components/hubspace/_dump_hs_raw.json
2024-08-01 10:43:26.573 DEBUG (MainThread) [custom_components.hubspace.coordinator] Adding device Basement office ceiling to light
2024-08-01 10:43:26.574 DEBUG (MainThread) [custom_components.hubspace.coordinator] Finished fetching hubspace data in 1.073 seconds (success: True)

Good afternoon. I just updated the Hubspace from HACS and was finally able to add my fan in homeassistant. But now I get this error…

Also I can only control the light. Not the fan…

any help would be greatly appreciated!

You can remove the entry in configuration.yaml, it is not needed anymore.

Post an issue on github for the light issue, the new developer who made the updates can help figure out why the light is not working.

1 Like

Thank you. I deleted the stuff from Configuration.yaml and that error went away but still no celling fan control. I will open an ticket on github.

Try version v3.0.3 from hacs. I am told it fixed the issue. If not, post an issue on github and provide the dumps requested in the readme.

Opps. Need to wait till next version is released or manually download code and replace…

1 Like

That fixed it. Thank you!

Just got my first hubspace device and was excited to find someone created an integration for them. Thank you.
However, I keep getting failed setup after configuring the integration. I’ve checked the logs but other than beginning setup I don’t see any logs. I’ve also followed the instructions for enabling debug but don’t see any debug files being created in the hubspace custom_components directly. Any ideas what might be happening?

Hello and thanks for all of the hard work! I noticed very recently (in the past week?) that my two Hubspace bulbs “11A19060WRGBWH1” seem to work OK, but a minute or two after I change them from within HA, HA seems to change their attributes such that they appear (only in HA, not in real life nor in the Hubspace app) as some warm white color - I’m guessing HA “understands” they are on, but perhaps times out on getting data back from the cloud such that HA can understand?

I tried the troubleshooting mentioned in the GitHub repo, but I’m getting a runtime error when I try to run anonymize_data.py (last bit below):

  File "C:\Users\MyUsername\.virtualenv\hubspace\Lib\site-packages\aiohttp\client.py", line 294, in __init__
    loop = loop or asyncio.get_running_loop()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: no running event loop

I poked around and was able to run TestHubspace.py successfully, if its output would be useful.

In either case, do you still need dumps from these lights? I’d be happy to help with that. I can open a GitHub issue with whatever info you’d like.

yes, please post a dump in an github issue. There was an issue that brightness was not initialized yet, so this is probably similar.

1 Like

I had the landscape transformer working, then after failing to add a switch I removed re-installed the integration and it no longer works.
I’ve removed/re-installed several times with several different versions. I can see it HACS but cant add the integration, I get this errror…

Config flow could not be loaded: {“message”:“Invalid handler specified”}

When I had it working before there was an entry in config.yaml but when I try to add those lines I get the following error when doing ‘check configuration’

Platform error light.hubspace - Exception importing custom_components.hubspace.light

Heres what I had it configuration.yaml…(its all lined up right, the page is reformatting)

light:

Any idea what Im doing wrong?

Update to the latest 3.1.0 version. It no longer uses the yaml setup you posted, but configured via the UI. Make sure to enter username and password in the UI (directions in readme). Maybe moving back and forth messed something up. There are still a few devices that do not work correctly with this new setup, possibly the transformer. The readme says how to post information if your device does not work.

If you revert to a 2.x version, you can use the YAML setup. But the new developer makes fixes quickly, so best to switch.

thanks for the quick reply. I’ve removed (verified folders were all gone) rebooted, re-installed 3.1 via HACS but when I try to add the integration I just keep getting…

Config flow could not be loaded: {“message”:“Invalid handler specified”}

Even rebooted the hardware after the removal…This has happened with all the versions I’ve tried. Is there something Im missing?

SyntaxError: invalid syntax
2024-08-12 21:29:07.223 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading configuration flow for integration hubspace: Exception importing custom_components.hubspace.config_flow
2024-08-12 21:29:08.101 WARNING (MainThread) [custom_components.localtuya.common] [ebf…hax] Failed to connect to 10.50.50.49: [Errno 113] Connect call failed (‘10.50.50.49’, 6668)

That is strange, sounds like you did everything right. Post an issue on github. The new dev can help.

If you delete folder, use hacs or manually download v2.03, and restore your yaml, it should hopefully work again, but be good to get it working in newest version.

My device type shows up as a WiFi signal strength monitor. The device is a AL-TP-RGBW-16FT. Not sure if I am missing something. I had these working before the update.

Please review the new readme and post the required info on github. The new dev should be able to add it back in. You should be able to revert while it is being worked.