Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding switch support #34

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
<p align="center">
<img src="https://github.com/homebridge/branding/raw/master/logos/homebridge-wordmark-logo-vertical.png" height="150"/>
<img src="https://developers.homebridge.io/assets/images/homebridge-color-round.svg" height="150"/>
</p>

<span align="center">

# Homebridge Hubspace
# Homebridge Home Depot Hubspace

<a href="https://www.npmjs.com/homebridge-hubspace">
<img src="https://img.shields.io/npm/v/homebridge-hubspace.svg?logo=npm&logoColor=fff&label=NPM+package&color=limegreen" alt="Hubspace for Homebridge on npm" />
</a>

<a href="https://github.com/homebridge/homebridge/wiki/Verified-Plugins">
<img title="Verified by Homebridge" src="https://badgen.net/badge/homebridge/verified/purple"/>
<a href="https://www.npmjs.com/homebridge-home-depot-hubspace">
<img src="https://img.shields.io/npm/v/homebridge-hubspace.svg?logo=npm&logoColor=fff&label=NPM+package&color=limegreen" alt="Hubspace for Home Depot Homebridge on npm" />
</a>

</span>
Expand All @@ -20,7 +16,8 @@
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.
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. This was forked by the
work done by sajmonr. Original repo can be found <a href="https://github.com/sajmonr/homebridge-hubspace#readme" target="_blank">here</a>

# 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.
Expand All @@ -31,6 +28,7 @@ Not all features for all products are implemented. Please see the functions belo
| --- | --- |
| [Universal Smart Wi-Fi 4-Speed Ceiling Fan](https://www.homedepot.com/p/Hampton-Bay-Universal-Smart-Wi-Fi-4-Speed-Ceiling-Fan-White-Remote-Control-For-Use-Only-With-AC-Motor-Fans-Powered-by-Hubspace-76278/315169181?) | <ul><li>Light on/off</li><li>Fan on/off</li><li>Light brightness</li><li>Fan speed</li></ul> |
| [Defiant Smart Plug](https://www.homedepot.com/p/Defiant-15-Amp-120-Volt-Smart-Wi-Fi-Bluetooth-Plug-with-1-Outlet-Powered-by-Hubspace-HPPA11AWB/315636834) | <ul><li>Power on/off</li></ul> |
| [Commercial Electric Single Pole Switch](https://www.homedepot.com/p/Commercial-Electric-15-Amp-Single-Pole-White-Smart-Light-Switch-with-Wi-Fi-and-Bluetooth-Technology-Powered-by-Hubspace-1-Pack-HPSA11CWB/320313682) | <ul><li>Power on/off</li></ul> |

# 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](https://developer.afero.io/API-DeviceEndpoints), however, this is in no way comprehensive.
Expand Down Expand Up @@ -77,4 +75,4 @@ Your payload should include the following fields.
| username | YOUR_USERNAME |
| password | YOUR_PASSWORD |

Once you receive the token you can make request to Afero with it to investigate the devices and commands.
Once you receive the token you can make request to Afero with it to investigate the devices and commands.
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"displayName": "Homebridge Hubspace",
"name": "homebridge-hubspace",
"version": "2.0.0-preview3",
"description": "Homebridge plugin for controlling Hubspace accessories.",
"homepage": "https://github.com/sajmonr/homebridge-hubspace#readme",
"author": "Adam Simonicek",
"displayName": "Homebridge Hubspace by Home Depot",
"name": "homebridge-home-depot-hubspace",
"version": "1.0.0",
"description": "Homebridge plugin for controlling Home Depot Hubspace accessories.",
"homepage": "https://github.com/fiestachickens/homebridge-home-depot-hubspace#readme",
"author": "Adam Simonicek - Forked by Cyrus Keck",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/sajmonr/homebridge-hubspace.git"
"url": "https://github.com/fiestachickens/homebridge-home-depot-hubspace.git"
},
"bugs": {
"url": "https://github.com/sajmonr/homebridge-hubspace/issues"
"url": "https://github.com/fiestachickens/homebridge-home-depot-hubspace/issues"
},
"engines": {
"node": ">=14.18.1",
Expand Down
12 changes: 11 additions & 1 deletion src/hubspace-devices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,15 @@ export const Devices: DeviceDef[] = [
characteristic: FunctionCharacteristic.Power
}
]
},
{
deviceClass: 'switch',
deviceType: DeviceType.Switch,
functions: [
{
functionClass: 'power',
characteristic: FunctionCharacteristic.Power
}
]
}
];
];
7 changes: 5 additions & 2 deletions src/models/device-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ export enum DeviceType{
None = 'none',
Light = 'light',
Fan = 'fan',
Outlet = 'power-outlet'
Outlet = 'power-outlet',
Switch = 'switch'
}

/**
Expand All @@ -21,7 +22,9 @@ export function getDeviceTypeForKey(key: string): DeviceType{
return DeviceType.Fan;
case 'power-outlet':
return DeviceType.Outlet;
case 'switch':
return DeviceType.Switch;
default:
return DeviceType.None;
}
}
}