2.1.0 • Published 9 months ago

@aleclombardo/homebridge-hubspace v2.1.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
9 months ago

About plugin

Hubspace is a platform for range of devices sold at HomeDepot. This plugin tries to integrate as many of these devices so that you can control them from HomeKit.

Disclaimer

I do not own any rights to Hubspace. Any work published here is solely for my own convenience. I am not making any guarantees about the code or products referenced here.

Tested products

Below you can find a table of products that have been tested with this plugin. Some products share similarities among one another (e.g. lights), however, that does not guarantee that they will all work.

Not all features for all products are implemented. Please see the functions below of what is implemented. If you need a feature that is not implemented create an issue for it.

ProductFunctions supported
Universal Smart Wi-Fi 4-Speed Ceiling FanLight on/offFan on/offLight brightnessFan speed
Defiant Smart PlugPower on/off
Smart 200 Watt Landscape TransformerZone power on/off

Development

There is no official documentation for Hubspace products. Under the hood they use Afero cloud as the mechanism that controls the products. Any functionality here is gained by experimenting with various functions of the devices. Afero provides simple explanation of their APIs, however, this is in no way comprehensive.

If you find that a product does not work as intended, or you want to request a new product, please create a ticket for it in the issues section. You are always more than welcome to create a PR with any fixes or additions to the plugin.

Local Testing

This repository uses Jest with ts-jest for testing. These tests are currently only set up for local validation. Some tests will be marked "skipped" using xdescribe or xit if they require access to real credentials. As convention, set HUBSPACE_USERNAME and HUBSPACE_PASSWORD environment variables, then remove the x from the describe or it blocks to run the live tests.

Guidelines

Any code you submit must be readable, be properly commented where necessary, and follow some common sense code quality.

This is a TypeScript project, therefore, TypeScript naming conventions must be followed, unless otherwise specified. Some basic naming conventions are below.

  1. Use PascalCase for type names.
  2. Do not use I as a prefix for interface names.
  3. Use PascalCase for enum values.
  4. Use camelCase for function names.
  5. Use camelCase for property names and local variables.
  6. Use _ as a prefix for private fields.
  7. Use whole words in names when possible. Only use abbreviations where their use is common and obvious.

Any ESLint issues need to be resolved before code can be merged. To check for production build linter issues you can run npm run prepublishOnly.

Adding new features

To add new features to the do the following:

  1. Create an issue for the feature (unless there is an issue already)
  2. Assign the issue to yourself
  3. Create a new branch for the issue and name is as {issue number}-{issue description} (e.g. 6-add-laser-support)
  4. Once ready issue a PR that is linked to the issue

Development authentication

Hubspace platform uses Keycloak for authentication. To develop new features you will need to request JWT from Keycloak to authenticate your requests against the platform.

To get the token send HTTP request with x-www-form-urlencoded body to the URL below.

POST https://accounts.hubspaceconnect.com/auth/realms/thd/protocol/openid-connect/token

Your payload should include the following fields.

KeyValue
grant_typepassword
client_idhubspace_android
usernameYOUR_USERNAME
passwordYOUR_PASSWORD

Once you receive the token you can make request to Afero with it to investigate the devices and commands.