Compare commits
3 Commits
1.1.0
...
1121dbc52c
Author | SHA1 | Date | |
---|---|---|---|
1121dbc52c | |||
bc2208b5cb | |||
845071c274 |
36
.drone.yml
36
.drone.yml
@ -18,7 +18,39 @@ steps:
|
|||||||
- npm install
|
- npm install
|
||||||
- npm run build
|
- npm run build
|
||||||
|
|
||||||
- name: publish
|
- name: version
|
||||||
|
image: node
|
||||||
|
commands:
|
||||||
|
- export version=`node -p "require('./package.json').version"`
|
||||||
|
- export commit=`echo $DRONE_COMMIT | cut -c1-5`
|
||||||
|
- npm version prerelease --preid=$commit --git-tag-version=false --allow-same-version=true
|
||||||
|
when:
|
||||||
|
event:
|
||||||
|
exclude:
|
||||||
|
- tag
|
||||||
|
- pull_request
|
||||||
|
branch:
|
||||||
|
include:
|
||||||
|
- master
|
||||||
|
|
||||||
|
- name: publish pre
|
||||||
|
image: plugins/npm
|
||||||
|
settings:
|
||||||
|
username: admin
|
||||||
|
password:
|
||||||
|
from_secret: npm_password
|
||||||
|
email: brandon@watsonlabs.net
|
||||||
|
registry: "http://linuxhost.me:4873/"
|
||||||
|
when:
|
||||||
|
event:
|
||||||
|
exclude:
|
||||||
|
- tag
|
||||||
|
- pull_request
|
||||||
|
branch:
|
||||||
|
include:
|
||||||
|
- master
|
||||||
|
|
||||||
|
- name: publish tagged version
|
||||||
image: plugins/npm
|
image: plugins/npm
|
||||||
settings:
|
settings:
|
||||||
username: admin
|
username: admin
|
||||||
@ -29,6 +61,8 @@ steps:
|
|||||||
when:
|
when:
|
||||||
event:
|
event:
|
||||||
- tag
|
- tag
|
||||||
|
exclude:
|
||||||
|
- pull_request
|
||||||
|
|
||||||
notify:
|
notify:
|
||||||
image: drillster/drone-email
|
image: drillster/drone-email
|
||||||
|
22
deploy.sh
22
deploy.sh
@ -1,22 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
remote_user="bmw"
|
|
||||||
remote_server="linuxhost.me"
|
|
||||||
deploy_location="/home/bmw/homebridge-harmony-control"
|
|
||||||
homebridge_location="/var/lib/homebridge/"
|
|
||||||
|
|
||||||
#build
|
|
||||||
tsc --build
|
|
||||||
#copy files to remote machine
|
|
||||||
scp -r bin $remote_user@$remote_server:$deploy_location
|
|
||||||
scp package.json $remote_user@$remote_server:$deploy_location
|
|
||||||
|
|
||||||
#install package
|
|
||||||
ssh -t $remote_user@$remote_server "sudo npm install -g --unsafe-perm $deploy_location"
|
|
||||||
|
|
||||||
#restart service
|
|
||||||
ssh -t
|
|
||||||
ssh -t $remote_user@$remote_server "sudo systemctl restart homebridge.service"
|
|
||||||
ssh -t $remote_user@$remote_server "sudo systemctl status homebridge.service"
|
|
||||||
|
|
||||||
echo done
|
|
||||||
exit
|
|
@ -3,5 +3,8 @@
|
|||||||
{
|
{
|
||||||
"path": "."
|
"path": "."
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"settings": {
|
||||||
|
"editor.tabSize": 2
|
||||||
|
}
|
||||||
}
|
}
|
@ -75,23 +75,28 @@ export class DeviceButton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Execute command
|
//Execute command
|
||||||
if (this._device) {
|
if (!this._device) {
|
||||||
//change state if stateful
|
return callback();
|
||||||
if (this._deviceInfo.IsStateful && this._buttonState != newState) {
|
}
|
||||||
this._buttonState = newState;
|
|
||||||
await this._device.sendCommand(this._deviceInfo.ButtonName);
|
//change state if stateful
|
||||||
} else if (!this._deviceInfo.IsStateful) {
|
if (this._deviceInfo.IsStateful && this._buttonState != newState) {
|
||||||
//Send the number of configured key presses
|
this._buttonState = newState;
|
||||||
for (let i = 0; i < this._deviceInfo.NumberOfKeyPresses; i++) {
|
await this._device.sendCommand(this._deviceInfo.ButtonName);
|
||||||
await this._device.sendCommand(this._deviceInfo.ButtonName);
|
return callback();
|
||||||
}
|
} else if (!this._deviceInfo.IsStateful) {
|
||||||
this._switchService
|
//Send the number of configured key presses
|
||||||
.getCharacteristic(this._platform.Characteristic.On)
|
for (let i = 0; i < this._deviceInfo.NumberOfKeyPresses; i++) {
|
||||||
.updateValue(false);
|
await this._device.sendCommand(this._deviceInfo.ButtonName);
|
||||||
return callback(new Error("Normal Response"));
|
}
|
||||||
}
|
|
||||||
|
this._switchService
|
||||||
|
.getCharacteristic(this._platform.Characteristic.On)
|
||||||
|
.updateValue(false);
|
||||||
|
|
||||||
|
this._buttonState = false;
|
||||||
|
return callback();
|
||||||
}
|
}
|
||||||
return callback();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2,19 +2,21 @@ import { IMatrix } from "./IMatrix";
|
|||||||
import { IActivity } from "./IActivity";
|
import { IActivity } from "./IActivity";
|
||||||
import { IDeviceButton } from "./IDeviceButton";
|
import { IDeviceButton } from "./IDeviceButton";
|
||||||
import { IDeviceConfig } from "./IDeviceConfig";
|
import { IDeviceConfig } from "./IDeviceConfig";
|
||||||
import { IHub } from './IHub';
|
import { IHub } from "./IHub";
|
||||||
|
import { ISequence } from "./ISequence";
|
||||||
|
|
||||||
export interface IControlUnit {
|
export interface IControlUnit {
|
||||||
DisplayName: string;
|
DisplayName: string;
|
||||||
Activities: Array<IActivity>;
|
Activities: Array<IActivity>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IConfig {
|
export interface IConfig {
|
||||||
hubIp: string;
|
hubIp: string;
|
||||||
EmitDevicesOnStartup: boolean;
|
EmitDevicesOnStartup: boolean;
|
||||||
Matrix: IMatrix;
|
Matrix: IMatrix;
|
||||||
ControlUnits: Array<IControlUnit>;
|
ControlUnits: Array<IControlUnit>;
|
||||||
DeviceButtons: Array<IDeviceButton>;
|
DeviceButtons: Array<IDeviceButton>;
|
||||||
Devices: Array<IDeviceConfig>;
|
Sequences: Array<ISequence>;
|
||||||
Hubs: Array<IHub>;
|
Devices: Array<IDeviceConfig>;
|
||||||
|
Hubs: Array<IHub>;
|
||||||
}
|
}
|
10
src/Models/Config/ISequence.ts
Normal file
10
src/Models/Config/ISequence.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
export interface ISequence {
|
||||||
|
name: string;
|
||||||
|
steps: Array<IStep>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IStep {
|
||||||
|
deviceName: string;
|
||||||
|
deviceCommand: string;
|
||||||
|
delay: number;
|
||||||
|
}
|
@ -22,7 +22,7 @@ export class Platform implements DynamicPlatformPlugin {
|
|||||||
) {
|
) {
|
||||||
this.log.debug("Finished initializing platform:", config.name);
|
this.log.debug("Finished initializing platform:", config.name);
|
||||||
|
|
||||||
this.config = (config as unknown) as IConfig;
|
this.config = config as unknown as IConfig;
|
||||||
//construct data provider
|
//construct data provider
|
||||||
const dataProvider = new HarmonyDataProvider({
|
const dataProvider = new HarmonyDataProvider({
|
||||||
hubs: this.config.Hubs,
|
hubs: this.config.Hubs,
|
||||||
@ -70,8 +70,8 @@ export class Platform implements DynamicPlatformPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public readonly Service: typeof Service = this.api.hap.Service;
|
public readonly Service: typeof Service = this.api.hap.Service;
|
||||||
public readonly Characteristic: typeof Characteristic = this.api.hap
|
public readonly Characteristic: typeof Characteristic =
|
||||||
.Characteristic;
|
this.api.hap.Characteristic;
|
||||||
|
|
||||||
// this is used to track restored cached accessories
|
// this is used to track restored cached accessories
|
||||||
public readonly accessories: PlatformAccessory[] = [];
|
public readonly accessories: PlatformAccessory[] = [];
|
||||||
|
Reference in New Issue
Block a user