Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
f8320319a4 | |||
779ffac227 | |||
55c65dac84 |
59
.drone.yml
59
.drone.yml
@ -2,6 +2,9 @@ kind: pipeline
|
|||||||
type: docker
|
type: docker
|
||||||
name: default
|
name: default
|
||||||
|
|
||||||
|
node:
|
||||||
|
lan: internal
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: build
|
- name: build
|
||||||
image: node
|
image: node
|
||||||
@ -57,6 +60,62 @@ steps:
|
|||||||
exclude:
|
exclude:
|
||||||
- pull_request
|
- pull_request
|
||||||
|
|
||||||
|
- name: remove old package
|
||||||
|
image: appleboy/drone-ssh
|
||||||
|
environment:
|
||||||
|
SSH_USER:
|
||||||
|
from_secret: ssh_user
|
||||||
|
settings:
|
||||||
|
host: homebridge.me
|
||||||
|
envs:
|
||||||
|
- SSH_USER
|
||||||
|
username:
|
||||||
|
from_secret: ssh_user
|
||||||
|
key:
|
||||||
|
from_secret: ssh_key
|
||||||
|
port: 22
|
||||||
|
script:
|
||||||
|
- rm -r /home/$SSH_USER/.npm-global/lib/node_modules/@watsonb8/homebridge-flux
|
||||||
|
when:
|
||||||
|
event:
|
||||||
|
- tag
|
||||||
|
exclude:
|
||||||
|
- pull_request
|
||||||
|
|
||||||
|
- name: deploy
|
||||||
|
image: appleboy/drone-ssh
|
||||||
|
settings:
|
||||||
|
host: homebridge.me
|
||||||
|
username:
|
||||||
|
from_secret: ssh_user
|
||||||
|
key:
|
||||||
|
from_secret: ssh_key
|
||||||
|
port: 22
|
||||||
|
script:
|
||||||
|
- npm install -g @watsonb8/homebridge-flux --registry http://10.44.1.6:4873
|
||||||
|
when:
|
||||||
|
event:
|
||||||
|
- tag
|
||||||
|
exclude:
|
||||||
|
- pull_request
|
||||||
|
|
||||||
|
- name: restart homebridge
|
||||||
|
image: appleboy/drone-ssh
|
||||||
|
settings:
|
||||||
|
host: homebridge.me
|
||||||
|
username:
|
||||||
|
from_secret: elevated_ssh_user
|
||||||
|
key:
|
||||||
|
from_secret: ssh_key
|
||||||
|
port: 22
|
||||||
|
script:
|
||||||
|
- systemctl restart homebridge
|
||||||
|
when:
|
||||||
|
event:
|
||||||
|
- tag
|
||||||
|
exclude:
|
||||||
|
- pull_request
|
||||||
|
|
||||||
- name: Notify
|
- name: Notify
|
||||||
image: drillster/drone-email
|
image: drillster/drone-email
|
||||||
settings:
|
settings:
|
||||||
|
33
.vscode/launch.json
vendored
33
.vscode/launch.json
vendored
@ -1,16 +1,19 @@
|
|||||||
{
|
{
|
||||||
// Use IntelliSense to learn about possible attributes.
|
// Use IntelliSense to learn about possible attributes.
|
||||||
// Hover to view descriptions of existing attributes.
|
// Hover to view descriptions of existing attributes.
|
||||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"type": "node",
|
"type": "node",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"name": "Launch Program",
|
"name": "Launch Program",
|
||||||
"preLaunchTask": "build and install",
|
"preLaunchTask": "build",
|
||||||
"program": "/Users/brandonwatson/.npm-global/bin/homebridge",
|
"program": "/Users/brandonwatson/.nvm/versions/node/v14.15.0/lib/node_modules/homebridge/bin/homebridge",
|
||||||
"sourceMaps": true,
|
"env": {
|
||||||
}
|
"HOMEBRIDGE_OPTS": "/Users/brandonwatson/.homebridge"
|
||||||
]
|
},
|
||||||
}
|
"sourceMaps": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
33
.vscode/tasks.json
vendored
33
.vscode/tasks.json
vendored
@ -1,17 +1,18 @@
|
|||||||
{
|
{
|
||||||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||||
// for the documentation about the tasks.json format
|
// for the documentation about the tasks.json format
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"tasks": [
|
"tasks": [
|
||||||
{
|
{
|
||||||
"type": "npm",
|
"type": "npm",
|
||||||
"script": "build",
|
"script": "build",
|
||||||
"problemMatcher": []
|
"label": "build",
|
||||||
},
|
"problemMatcher": []
|
||||||
{
|
},
|
||||||
"type": "shell",
|
{
|
||||||
"label": "build and install",
|
"type": "shell",
|
||||||
"command": "npm run build&&sudo npm install -g --unsafe-perm ."
|
"label": "build and install",
|
||||||
}
|
"command": "npm run build&&sudo npm install -g --unsafe-perm ."
|
||||||
]
|
}
|
||||||
}
|
]
|
||||||
|
}
|
||||||
|
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@watsonb8/homebridge-flux",
|
"name": "@watsonb8/homebridge-flux",
|
||||||
"version": "1.1.1",
|
"version": "1.1.3",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@watsonb8/homebridge-flux",
|
"name": "@watsonb8/homebridge-flux",
|
||||||
"version": "1.1.1",
|
"version": "1.1.3",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "bin/index.js",
|
"main": "bin/index.js",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
@ -8,7 +8,6 @@ import { IConfig } from "./models/iConfig";
|
|||||||
import { GetTimesResult, getTimes } from "suncalc";
|
import { GetTimesResult, getTimes } from "suncalc";
|
||||||
import HueError = require("node-hue-api/lib/HueError");
|
import HueError = require("node-hue-api/lib/HueError");
|
||||||
import cron from "node-cron";
|
import cron from "node-cron";
|
||||||
import { callbackify } from "util";
|
|
||||||
|
|
||||||
let Service: HAPNodeJS.Service;
|
let Service: HAPNodeJS.Service;
|
||||||
let Characteristic: HAPNodeJS.Characteristic;
|
let Characteristic: HAPNodeJS.Characteristic;
|
||||||
@ -102,6 +101,7 @@ export class FluxAccessory implements IAccessory {
|
|||||||
.getCharacteristic(Characteristic.On)
|
.getCharacteristic(Characteristic.On)
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
.on("set", this.onSetEnabled)
|
.on("set", this.onSetEnabled)
|
||||||
|
//@ts-ignore
|
||||||
.on("get", this.onGetEnabled);
|
.on("get", this.onGetEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,9 +134,12 @@ export class FluxAccessory implements IAccessory {
|
|||||||
* Handler for switch get event
|
* Handler for switch get event
|
||||||
* @param callback The callback function to call when complete
|
* @param callback The callback function to call when complete
|
||||||
*/
|
*/
|
||||||
private onGetEnabled = (): boolean => {
|
private onGetEnabled(
|
||||||
return this._isActive;
|
callback: (error: Error | null, value: boolean) => void
|
||||||
};
|
): void {
|
||||||
|
callback(null, this._isActive);
|
||||||
|
// return this._isActive;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called by homebridge to gather services.
|
* Called by homebridge to gather services.
|
||||||
|
Reference in New Issue
Block a user