Skip to content

Commit

Permalink
Update switchbot-openapi.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
donavanbecker committed Dec 22, 2024
1 parent 6e019c7 commit 13e14b1
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/switchbot-openapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export class SwitchBotOpenAPI extends EventEmitter {
try {
const configToken = token || this.token
const configSecret = secret || this.secret
const { body, statusCode } = await request(`${this.baseURL}/devices/${deviceId}/commands`, {
const { body, statusCode } = await request(`${urls.devicesURL}/${deviceId}/commands`, {
method: 'POST',
headers: this.generateHeaders(configToken, configSecret),
body: JSON.stringify({
Expand Down Expand Up @@ -158,10 +158,7 @@ export class SwitchBotOpenAPI extends EventEmitter {
try {
const configToken = token || this.token
const configSecret = secret || this.secret
const { body, statusCode } = await request(`${this.baseURL}/devices/${deviceId}/status`, {
method: 'GET',
headers: this.generateHeaders(configToken, configSecret),
})
const { body, statusCode } = await request(`${urls.devicesURL}/${deviceId}/status`, { headers: this.generateHeaders(configToken, configSecret) })
const response = await body.json() as deviceStatus
this.emitLog('debug', `Got device status: ${deviceId}`)
this.emitLog('debug', `statusCode: ${statusCode}`)
Expand Down

0 comments on commit 13e14b1

Please sign in to comment.