Add support for Hubspace by Afero

Use jdeath original version, I don’t think sharngmc is up to date.
Only use friendlyname GuestOfficeFan, not the roomnames: as well. You only need one or the other. Once you do that, confirm you can control the fan (it will be called light.guestofficefan_fan). Once you confirm you can use the fan, make the template. You need to change the template to match. The template you posted in has entity_id: light.cielingfan_fan , but your entity is light.guestofficefan_fan

So i started over again this morning.
First i removed shawngmc HACS custom repo; restarted core
Then installed Jdeath HACS custom repo; restared core

Next I added to configuration.yaml the following details based on the repo instructions.

#Hubspace https://github.com/jdeath/Hubspace-Homeassistant

light:
  - platform: hubspace
    username: '[email protected]'
    password: 'PassWord@1234'
    debug: true
    friendlynames:
      - 'GuestOfficeFan'

In developer tools - check configuration gives the following feedback:

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

Running

Home Assistant 2023.3.3 Supervisor 2023.03.1 Operating System 9.5 Frontend 20230309.0 - latest

First, your syntax is wrong. Look at the directions on github, you need a - before platform, aligned under the g in light. These things matter!. If that alone does not work, try no quotes on the username and password. If have and crazy characters in the password, change your password to something simpler.

i dont get it. My configuration.yaml is not complex:


# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

#TP Link / Kasa
tplink:
  discovery: false
  switch:
    - host: 192.168.30.50
    
# do not use Hubspace https://github.com/shawngmc/Hubspace-Homeassistant
# Hubspace https://github.com/jdeath/Hubspace-Homeassistant/

light:
  - platform: hubspace
    username: [email protected]
    password: your_hubspace_password
    debug: false  
    friendlynames: 
      - 'BoysLight'  

      
# Text to speech
tts:
  - platform: google_translate

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

# Keymaster
homeassistant:
  packages: !include_dir_named packages

Note that i copied the light example directly from the repo. With this config i am expecting hubspace to fail as the username/password are wrong. I also disabled pihole just in case…

But this actual Developer check error points to an issue with the scripts located in config/custom_components/hubspace/… Files which are replicated from the repo today.
For username/password i tried no quotes, single and double quotes - no change.

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

I am not sure. Never seen this before. Delete the custom_componnts/hubspace directory and download it fresh via HACS. Perhaps you didn’t get all the raw files or they are in dos format for something.

Look in your logs. If the component loaded correctly, you should see below. Look for other loading issues. My guess is you messed something up if you downloaded it manually. HACS is the way to go

2023-03-10 07:00:59.992 WARNING (SyncWorker_0) [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

I had to use Terminal to delete the full hubspace folders. File Editor alone was not doing it, some hidden folder… :zipper_mouth_face:

Restart, redownload repo and now i am seeing

2023-03-11 11:03:35.806 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration hacs 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
2023-03-11 11:03:35.807 WARNING (SyncWorker_0) [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

added to configuration.yaml

light:
  - platform: hubspace
    username: [email protected]
    password: "NotMy@Passw0rd"
    debug: true
    friendlynames:
      - "GuestOfficeFan"

and in Settings > Entities i have an hubspace integration light.guestofficefan that i can use to turn the light on/off.

there is no guestofficefan_fan? Try restarting without

friendlynames:
      - "GuestOfficeFan"

The integration may find it automatically. You should have two entities, one with _fan

I have gotten the lock to show on my dashboard, but the lock and unlock button does nothing. Screenshot 2023-03-12 193812

  1. Remove the (optional…) and (the name of…), those are comments in documentation and should be removed in your setup. I’ll try to make the documentation more clear about that.
  2. Be sure you can control the lock (as a light) before messing with the template, the template is 100% optional. Don’t mess with the template until you can control the lock from homeassistant.
  3. Your template and names are all cross-wise. Your friendlyname is ‘FrontDoor’ so you need to name the template something else, like FrontDoorLock. Then, the light.door_lock in your template you posted should be changed to light.frontdoor, because that is the real name home assistant needs to control. Make sense?

I’m also still having issues. Seems (according to logs) that the integration never gets loaded. Have checked yaml many times. Ideas?

Logger: homeassistant.components.light
Source: custom_components/hubspace/hubspace.py:89
Integration: Light (documentation, issues)
First occurred: 7:45:29 PM (1 occurrences)
Last logged: 7:45:29 PM

Error while setting up hubspace platform for light
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 293, 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

Here is my yaml:


light:
  - platform: hubspace
    username: [email protected]
    password: !secret hubspace_password
    debug: true 

Looks like your login is failing. Check your password (put it in directly and not use a secret). Use a simple password without funny characters to test and do not use quotation marks around it.

Wow. That fixed it. Not a very clear error, but thank you!!!

1 Like

Hello,

I have got your integration working with my recessed rgbw can lights. I thought I was SOL with intergrating these. Thanks for coming up with a solution.

It seems to have full control of the rgb and dimming, its just that it takes roughly 30 seconds for changes to be applied to my lights. Do you have an idea of how to make it quicker to respond?

Not sure why so slow, but I only have one light. Changing the light should be quick, but it will take home assistant 30 seconds to know about the update. I am not sure how to speed it up, since it interacts with the cloud. I used very simple python calls, there is probably a way to make it better (async), but it is beyond my skills.

Ok well thanks anyways. I’m just happy progress with Hubspace integration has been made. I’ll have to do more tinkering.

Thank you! Now I have the lock added and clicking the button locks and unlocks the door but the lock state never updates - it always shows unlocked even when locked

Does the “light” version update without using the template? It will take 30s to update. Once you confirm the “light” updates, check the template. A version is posted in github repo. You need to make sure the value_template entity matches your lock name exactly (that is probably the issue).

Yes the light version works. image

If I reboot sometimes the lock will display correctly for 1 time. Once its unlocked and relocked it displays incorrectly again

That looks good to me. Maybe change optimistic to false and see if better? Also, I don’t think it matters, but change unique_id to something else like FrontDoor123

I tried that and still no luck. The light button works and shows the on when locked and off when unlocked. The template always shows unlocked. Is there a different way to update the state?