Compare commits
No commits in common. "master" and "v1.1.4" have entirely different histories.
130
.drone.yml
Normal file
130
.drone.yml
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: default
|
||||||
|
|
||||||
|
node:
|
||||||
|
lan: internal
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: build
|
||||||
|
image: node
|
||||||
|
commands:
|
||||||
|
- npm install
|
||||||
|
- npm run build
|
||||||
|
|
||||||
|
- 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: node
|
||||||
|
environment:
|
||||||
|
token:
|
||||||
|
from_secret: npm_token
|
||||||
|
commands:
|
||||||
|
- npm config set @watsonb8:registry https://gitea.watsonlabs.net/api/packages/watsonb8/npm/
|
||||||
|
- npm config set -- '//gitea.watsonlabs.net/api/packages/watsonb8/npm/:_authToken' "$token"
|
||||||
|
- npm publish
|
||||||
|
when:
|
||||||
|
event:
|
||||||
|
exclude:
|
||||||
|
- tag
|
||||||
|
- pull_request
|
||||||
|
branch:
|
||||||
|
include:
|
||||||
|
- master
|
||||||
|
|
||||||
|
- name: publish tagged version
|
||||||
|
image: node
|
||||||
|
environment:
|
||||||
|
token:
|
||||||
|
from_secret: npm_token
|
||||||
|
commands:
|
||||||
|
- npm config set @watsonb8:registry https://gitea.watsonlabs.net/api/packages/watsonb8/npm/
|
||||||
|
- npm config set -- '//gitea.watsonlabs.net/api/packages/watsonb8/npm/:_authToken' "$token"
|
||||||
|
- npm publish
|
||||||
|
when:
|
||||||
|
event:
|
||||||
|
- tag
|
||||||
|
exclude:
|
||||||
|
- 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 https://gitea.watsonlabs.net
|
||||||
|
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
|
||||||
|
image: drillster/drone-email
|
||||||
|
settings:
|
||||||
|
host: 10.44.1.13
|
||||||
|
username: srvGitea
|
||||||
|
password:
|
||||||
|
from_secret: smtp_password
|
||||||
|
from: drone@watsonlabs.net
|
||||||
|
skip_verify: true
|
||||||
|
when:
|
||||||
|
status:
|
||||||
|
- failure
|
@ -1,85 +0,0 @@
|
|||||||
name: Build homebridge-flux
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
name: Build
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: 18
|
|
||||||
- run: |
|
|
||||||
npm ci
|
|
||||||
npm run build
|
|
||||||
|
|
||||||
version:
|
|
||||||
name: Version
|
|
||||||
outputs:
|
|
||||||
version: ${{ steps.get_version.outputs.version }}
|
|
||||||
commit: ${{ steps.get_version.outputs.commit }}
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: 18
|
|
||||||
- id: get_version
|
|
||||||
name: Set Version
|
|
||||||
run: |
|
|
||||||
export version=`node -p "require('./package.json').version"`
|
|
||||||
export commit=`echo $GITHUB_SHA | cut -c1-5`
|
|
||||||
echo "version=$version" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "commit=$commit" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
publish_tagged:
|
|
||||||
name: Publish Latest
|
|
||||||
needs:
|
|
||||||
- build
|
|
||||||
- version
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: actions/setup-node@v4
|
|
||||||
- run: npm config set @watsonb8:registry https://gitea.watsonlabs.net/api/packages/watsonb8/npm/
|
|
||||||
- name: Publish
|
|
||||||
env:
|
|
||||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
||||||
COMMIT: ${{ needs.version.outputs.commit }}
|
|
||||||
run: |
|
|
||||||
npm config set -- '//gitea.watsonlabs.net/api/packages/watsonb8/npm/:_authToken' "$NPM_TOKEN"
|
|
||||||
npm version prerelease --preid="$COMMIT" --git-tag-version=false --allow-same-version=true
|
|
||||||
npm publish
|
|
||||||
|
|
||||||
deploy:
|
|
||||||
runs-on:
|
|
||||||
- ubuntu-latest
|
|
||||||
- internal
|
|
||||||
name: Deploy
|
|
||||||
needs:
|
|
||||||
- publish_tagged
|
|
||||||
- version
|
|
||||||
steps:
|
|
||||||
- name: Set up SSH key
|
|
||||||
run: |
|
|
||||||
mkdir -p ~/.ssh
|
|
||||||
echo "${{ secrets.ELEVATED_HOMEBRIDGE_SSH_KEY }}" > ~/.ssh/id_rsa
|
|
||||||
chmod 600 ~/.ssh/id_rsa
|
|
||||||
ssh-keyscan -p 22 homebridge.me >> ~/.ssh/known_hosts
|
|
||||||
sudo apt update
|
|
||||||
sudo apt install sshpass
|
|
||||||
|
|
||||||
- name: Remove old Package
|
|
||||||
run: |
|
|
||||||
sshpass -p '${{ secrets.ELEVATED_HOMEBRIDGE_PASSWORD }}' ssh -v -o StrictHostKeyChecking=no ${{ secrets.ELEVATED_HOMEBRIDGE_USER }}@${{ secrets.HOMEBRIDGE_HOST }} <<'ENDSSH'
|
|
||||||
rm -r /home/${{ secrets.HOMEBRIDGE_USER }}/.npm-global/lib/node_modules/@watsonb8/homebridge-flux
|
|
||||||
ENDSSH
|
|
||||||
- name: Deploy
|
|
||||||
env:
|
|
||||||
COMMIT: ${{ needs.version.outputs.commit }}
|
|
||||||
run: |
|
|
||||||
sshpass -p '${{ secrets.ELEVATED_HOMEBRIDGE_PASSWORD }}' ssh -v -o StrictHostKeyChecking=no ${{ secrets.ELEVATED_HOMEBRIDGE_USER }}@${{ secrets.HOMEBRIDGE_HOST }} <<'ENDSSH'
|
|
||||||
npm install -g @watsonb8/homebridge-flux@$COMMIT
|
|
||||||
ENDSSH
|
|
@ -102,33 +102,18 @@
|
|||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"required": true
|
"required": true
|
||||||
},
|
},
|
||||||
"hueCeilingColorTemp": {
|
"ceilingColorTemp": {
|
||||||
"title": "Hue Ceiling Color Temperature",
|
"title": "Ceiling Color Temperature",
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"required": true
|
"required": true
|
||||||
},
|
},
|
||||||
"hueSunsetColorTemp": {
|
"sunsetColorTemp": {
|
||||||
"title": "Hue Sunset Color Temperature",
|
"title": "Sunset Color Temperature",
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"required": true
|
"required": true
|
||||||
},
|
},
|
||||||
"hueFloorColorTemp": {
|
"floorColorTemp": {
|
||||||
"title": "Hue Floor Color Temperature",
|
"title": "Floor Color Temperature",
|
||||||
"type": "number",
|
|
||||||
"required": true
|
|
||||||
},
|
|
||||||
"wizCeilingColorTemp": {
|
|
||||||
"title": "Wiz Ceiling Color Temperature",
|
|
||||||
"type": "number",
|
|
||||||
"required": true
|
|
||||||
},
|
|
||||||
"wizSunsetColorTemp": {
|
|
||||||
"title": "Wiz Sunset Color Temperature",
|
|
||||||
"type": "number",
|
|
||||||
"required": true
|
|
||||||
},
|
|
||||||
"wizFloorColorTemp": {
|
|
||||||
"title": "Wiz Floor Color Temperature",
|
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"required": true
|
"required": true
|
||||||
},
|
},
|
||||||
|
1382
package-lock.json
generated
1382
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@watsonb8/homebridge-flux",
|
"name": "@watsonb8/homebridge-flux",
|
||||||
"version": "1.2.0",
|
"version": "1.1.4",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "bin/index.js",
|
"main": "bin/index.js",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
@ -34,7 +34,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/node-cron": "^2.0.3",
|
"@types/node-cron": "^2.0.3",
|
||||||
"@types/suncalc": "^1.8.0",
|
"@types/suncalc": "^1.8.0",
|
||||||
"@watsonb8/wiz-lib": "^1.0.1-ae175.0",
|
"@watsonb8/wiz-lib": "^1.0.1-e1c84.0",
|
||||||
"node-cron": "^2.0.3",
|
"node-cron": "^2.0.3",
|
||||||
"node-hue-api": "^4.0.5",
|
"node-hue-api": "^4.0.5",
|
||||||
"suncalc": "^1.8.0"
|
"suncalc": "^1.8.0"
|
||||||
|
@ -235,56 +235,35 @@ export class FluxAccessory {
|
|||||||
this._times.sunrise.getTime() + 1 * SECONDS_IN_DAY
|
this._times.sunrise.getTime() + 1 * SECONDS_IN_DAY
|
||||||
);
|
);
|
||||||
|
|
||||||
const hueStartColorTemp = this._config.hueCeilingColorTemp ?? 4000;
|
const startColorTemp = this._config.ceilingColorTemp ?? 4000;
|
||||||
const hueSunsetColorTemp = this._config.hueSunsetColorTemp ?? 2800;
|
const sunsetColorTemp = this._config.sunsetColorTemp ?? 2800;
|
||||||
const hueFloorColorTemp = this._config.hueFloorColorTemp ?? 1900;
|
const floorColorTemp = this._config.floorColorTemp ?? 1900;
|
||||||
|
|
||||||
const wizStartColorTemp = this._config.wizCeilingColorTemp ?? 4000;
|
let newTemp = this._config.ceilingColorTemp;
|
||||||
const wizSunsetColorTemp = this._config.wizSunsetColorTemp ?? 2800;
|
|
||||||
const wizFloorColorTemp = this._config.wizFloorColorTemp ?? 1900;
|
|
||||||
|
|
||||||
let newHueTemp = this._config.hueCeilingColorTemp;
|
|
||||||
let newWizTemp = this._config.wizCeilingColorTemp;
|
|
||||||
|
|
||||||
if (start < now && now < sunsetStart) {
|
if (start < now && now < sunsetStart) {
|
||||||
newHueTemp = this.getTempOffset(
|
newTemp = this.getTempOffset(
|
||||||
hueStartColorTemp,
|
startColorTemp,
|
||||||
hueSunsetColorTemp,
|
sunsetColorTemp,
|
||||||
start,
|
|
||||||
sunsetStart
|
|
||||||
);
|
|
||||||
|
|
||||||
newWizTemp = this.getTempOffset(
|
|
||||||
wizStartColorTemp,
|
|
||||||
wizSunsetColorTemp,
|
|
||||||
start,
|
start,
|
||||||
sunsetStart
|
sunsetStart
|
||||||
);
|
);
|
||||||
} else if (sunsetStart < now && now < sunsetEnd) {
|
} else if (sunsetStart < now && now < sunsetEnd) {
|
||||||
newHueTemp = this._config.hueSunsetColorTemp;
|
newTemp = this._config.sunsetColorTemp;
|
||||||
newWizTemp = this._config.wizSunsetColorTemp;
|
|
||||||
} else if (sunsetEnd < now && now < nightStart) {
|
} else if (sunsetEnd < now && now < nightStart) {
|
||||||
newHueTemp = this.getTempOffset(
|
newTemp = this.getTempOffset(
|
||||||
hueSunsetColorTemp,
|
sunsetColorTemp,
|
||||||
hueFloorColorTemp,
|
floorColorTemp,
|
||||||
sunsetEnd,
|
|
||||||
nightStart
|
|
||||||
);
|
|
||||||
|
|
||||||
newWizTemp = this.getTempOffset(
|
|
||||||
wizSunsetColorTemp,
|
|
||||||
wizFloorColorTemp,
|
|
||||||
sunsetEnd,
|
sunsetEnd,
|
||||||
nightStart
|
nightStart
|
||||||
);
|
);
|
||||||
} else if (nightStart < now && now < sunrise) {
|
} else if (nightStart < now && now < sunrise) {
|
||||||
newHueTemp = this._config.hueFloorColorTemp;
|
newTemp = this._config.floorColorTemp;
|
||||||
newWizTemp = this._config.wizFloorColorTemp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Set RGB
|
//Set RGB
|
||||||
this._hueRGB = colorTempToRgb(newHueTemp);
|
this._hueRGB = colorTempToRgb(newTemp);
|
||||||
this._wizRGB = colorTemperature2rgb(newWizTemp);
|
this._wizRGB = colorTemperature2rgb(newTemp);
|
||||||
};
|
};
|
||||||
|
|
||||||
private scheduleLights = async (): Promise<void> => {
|
private scheduleLights = async (): Promise<void> => {
|
||||||
|
@ -34,32 +34,17 @@ export interface IConfig {
|
|||||||
/**
|
/**
|
||||||
* The color temperature at the start of sunset transition
|
* The color temperature at the start of sunset transition
|
||||||
*/
|
*/
|
||||||
hueCeilingColorTemp: number;
|
ceilingColorTemp: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The color temp during the night
|
* The color temp during the night
|
||||||
*/
|
*/
|
||||||
hueFloorColorTemp: number;
|
floorColorTemp: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The color temp at sunet
|
* The color temp at sunet
|
||||||
*/
|
*/
|
||||||
hueSunsetColorTemp: number;
|
sunsetColorTemp: number;
|
||||||
|
|
||||||
/**
|
|
||||||
* The color temperature at the start of sunset transition
|
|
||||||
*/
|
|
||||||
wizCeilingColorTemp: number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The color temp during the night
|
|
||||||
*/
|
|
||||||
wizFloorColorTemp: number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The color temp at sunet
|
|
||||||
*/
|
|
||||||
wizSunsetColorTemp: number;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The time in milliseconds the lights should remain at sunset temperature.
|
* The time in milliseconds the lights should remain at sunset temperature.
|
||||||
|
Loading…
Reference in New Issue
Block a user