Skip to content

Commit

Permalink
add hostname option to config
Browse files Browse the repository at this point in the history
  • Loading branch information
donavanbecker committed Dec 17, 2024
1 parent 5151595 commit 680ecc8
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 50 deletions.
7 changes: 7 additions & 0 deletions config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -11790,6 +11790,12 @@
"title": "Disable Logging from OpenAPI",
"type": "boolean"
},
"hostname": {
"title": "hostname",
"type": "string",
"placeholder": "https://api.switch-bot.com",
"description": "Allows for the override of the SwitchBot API hostname."
},
"webhookURL": {
"title": "Webhook URL",
"type": "string",
Expand Down Expand Up @@ -13449,6 +13455,7 @@
"key": "options.disableLogsforOpenAPI",
"description": "This will disable the logs coming from <em class='primary-text>node-switchbot</em> OpenAPI."
},
"options.hostname",
"options.webhookURL",
"options.mqttURL",
"options.mqttOptions",
Expand Down
90 changes: 45 additions & 45 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"async-mqtt": "^2.6.3",
"fakegato-history": "^0.6.5",
"homebridge-lib": "^7.1.1",
"node-switchbot": "^3.4.2-beta.3",
"node-switchbot": "^3.4.2-beta.4",
"rxjs": "^7.8.1"
},
"devDependencies": {
Expand All @@ -93,14 +93,14 @@
"@types/semver": "^7.5.8",
"@types/source-map-support": "^0.5.10",
"@vitest/coverage-v8": "^2.1.8",
"eslint": "^9.16.0",
"eslint": "^9.17.0",
"eslint-plugin-format": "^0.1.3",
"homebridge": "^1.8.5",
"homebridge-config-ui-x": "4.65.0",
"homebridge-config-ui-x": "4.65.1",
"nodemon": "^3.1.9",
"shx": "^0.3.4",
"ts-node": "^10.9.2",
"typedoc": "^0.27.4",
"typedoc": "^0.27.5",
"typescript": "^5.7.2",
"vitest": "^2.1.8"
},
Expand Down
3 changes: 2 additions & 1 deletion src/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import type { blindTilt, curtain, curtain3, device, deviceStatus, deviceStatusRe
import type { blindTiltConfig, curtainConfig, devicesConfig, irDevicesConfig, options, SwitchBotPlatformConfig } from './settings.js'

import { readFileSync } from 'node:fs'
import { hostname } from 'node:os'
import process, { argv } from 'node:process'

import asyncmqtt from 'async-mqtt'
Expand Down Expand Up @@ -138,7 +139,7 @@ export class SwitchBotPlatform implements DynamicPlatformPlugin {

// SwitchBot OpenAPI
if (this.config.credentials?.token && this.config.credentials?.secret) {
this.switchBotAPI = new SwitchBotOpenAPI(this.config.credentials.token, this.config.credentials.secret)
this.switchBotAPI = new SwitchBotOpenAPI(this.config.credentials.token, this.config.credentials.secret, this.config.options?.hostname)
} else {
this.debugErrorLog('Missing SwitchBot API credentials (token or secret).')
}
Expand Down
1 change: 1 addition & 0 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export interface options {
discoverBLE?: boolean
disableLogsforBLE?: boolean
disableLogsforOpenAPI?: boolean
hostname?: string
webhookURL?: string
maxRetries?: number
delayBetweenRetries?: number
Expand Down

0 comments on commit 680ecc8

Please sign in to comment.