Skip to content

Commit

Permalink
Merge pull request #3 from sbehrends/homebridge-platform
Browse files Browse the repository at this point in the history
Homebridge platform support
  • Loading branch information
sbehrends authored Apr 20, 2019
2 parents d93d516 + 6c07f26 commit 70d79b3
Show file tree
Hide file tree
Showing 17 changed files with 2,479 additions and 320 deletions.
13 changes: 13 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"presets": [
["@babel/preset-env",
{
"targets": {
"node": "4"
},
"useBuiltIns": "usage",
"corejs": 3
}
]
]
}
46 changes: 46 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
version: 2
defaults: &defaults
working_directory: ~/repo
docker:
- image: circleci/node:10.15
jobs:
test:
<<: *defaults
steps:
- checkout
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- run:
name: Install dependencies
command: npm install
- save_cache:
key: dependency-cache-{{ checksum "package.json" }}
paths:
- node_modules
- run:
name: Test
command: npm run test

publish:
<<: *defaults
steps:
- run:
name: Authenticate with registry
command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/repo/.npmrc
- run:
name: Publish package
command: npm publish

workflows:
version: 2
test-and-publish:
jobs:
- test
- publish:
requires:
- test
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
dist
29 changes: 13 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,26 @@ A [Homebridge](https://github.com/nfarina/homebridge) plugin for "BGH Smart Cont

It uses https://bgh-services.solidmation.com/ API to interact with your registered devices

### Major change from 1.0.0

On version <= 1.0.0 the behavior of the plugin changed. *Instead of being a configurable accesory* in your homebridge config file, now *it's a platform*.

*The configuration got easier and it will autodiscover all your available devices* in your account. (It only requires email and password)

![BGH Smart AC in Home](screenshot.jpg?raw=true "BGH Smart AC in Home")

### Installation

```
npm install homebridge-bgh-smart -g
```

Add to your configuration
Add to your homebridge configuration

```
{
"accessory": "BGH-Smart",
"name": "Accesory Name",
"platforms": [{
"platform": "BGH-Smart",
"email": "[email protected]",
"password": "password",
"deviceName": "Device name in Solidmation",
"homeId": "12345",
"deviceId": "12345"
}
"password": "password"
}]
```

To help you finding homeId and deviceId paste this on the browser cosnole while logged in at the [Dashboard](https://bgh-services.solidmation.com/control/Panel.aspx) Source available in getDevicesHelper.js

```
function getDevices(a){jQuery.ajax({type:"POST",url:"https://bgh-services.solidmation.com/1.0/HomeCloudService.svc/GetDataPacket",contentType:"application/json",data:JSON.stringify({token:HCData.AccessToken,homeID:a,serials:{Home:0,Groups:0,Devices:0,Endpoints:0,EndpointValues:0,Scenes:0,Macros:0,Alarms:0},timeOut:1e4}),success:function(a){if(a.GetDataPacketResult.Endpoints.length>0)for(var b=0;b<a.GetDataPacketResult.Endpoints.length;b++){var c=a.GetDataPacketResult.Endpoints[b],d={accessory:"BGH-Smart",name:c.Description,email:"[email protected]",password:"password",deviceName:c.Description,homeId:c.HomeID,deviceId:c.EndpointID};alert(JSON.stringify(d))}}})}var c=$.cookie("HCData");if(c){var HCData=JSON.parse(c);HCData.AccessToken={Token:decodeURIComponent(HCData.AccessToken)},HCData.FirstName=decodeURIComponent(HCData.FirstName),HCData.LastName=decodeURIComponent(HCData.LastName),jQuery.ajax({type:"POST",url:"https://bgh-services.solidmation.com/1.0/HomeCloudService.svc/EnumHomes",contentType:"application/json",data:JSON.stringify({token:HCData.AccessToken}),success:function(a){if(a.EnumHomesResult&&a.EnumHomesResult.Homes)for(var b=0;b<a.EnumHomesResult.Homes.length;b++){var c=a.EnumHomesResult.Homes[b];getDevices(c.HomeID)}}})}
```

15 changes: 15 additions & 0 deletions config.example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"bridge": {
"name": "Homebridge",
"username": "CC:22:3D:E3:CE:32",
"port": 51826,
"pin": "031-45-154"
},

"platforms": [{
"platform": "Solidmation",
"user": "[email protected]",
"password": "secret",
"homeFilter": []
}]
}
Loading

0 comments on commit 70d79b3

Please sign in to comment.