Skip to content

Commit

Permalink
Small fixes to prevent unknown device ID errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisTerBeke committed Oct 19, 2024
1 parent 99eedcf commit 1dcff5c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/uponor/device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ class UponorThermostatDevice extends Device {
private _client?: UponorHTTPClient

async onInit(): Promise<void> {
this.registerCapabilityListener('target_temperature', this._setTargetTemperature.bind(this))
this._init()
}

Expand Down Expand Up @@ -61,7 +60,9 @@ class UponorThermostatDevice extends Device {
}

async _init(): Promise<void> {
await this._uninit()
// TODO: implement dynamic capability system like the Remeha app
this.registerCapabilityListener('target_temperature', this._setTargetTemperature.bind(this))

const address = this._getAddress()
if (!address) return this.setUnavailable('No IP address configured')

Expand All @@ -71,7 +72,7 @@ class UponorThermostatDevice extends Device {
if (!canConnect) return this.setUnavailable(`Could not connect to Uponor controller on IP address ${address}`)
this._client = client
this._syncInterval = setInterval(this._syncAttributes.bind(this), POLL_INTERVAL_MS)
this._syncAttributes()
setTimeout(this._syncAttributes.bind(this), 2000)
} catch (error) {
this.setUnavailable(`Error connecting to Uponor controller: ${error}`)
}
Expand Down

0 comments on commit 1dcff5c

Please sign in to comment.