Skip to content

Commit

Permalink
Added handling of null values
Browse files Browse the repository at this point in the history
  • Loading branch information
MadErstam committed Mar 27, 2023
1 parent a40ea28 commit ca103fe
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ class Controme extends utils.adapter {
// this.subscribeStates("*.setpointTemperature");
// extract the roomID from id
const roomID = id.match(/^controme\.\d\.(\d+)/);
if (roomID !== null) {
if (roomID !== null && state.val !== null) {
this.log.debug(`Room ${roomID[1]}: Calling setSetpointTemp(${roomID[1]}, ${state.val})`);
this._setSetpointTemp(roomID[1], state.val);
} else {
Expand All @@ -671,7 +671,7 @@ class Controme extends utils.adapter {
// extract the roomID and sensorID from id
const roomID = id.match(/^controme\.\d\.(\d+)/);
const sensorID = id.match(/\.sensors\.([0-9a-f_:]+)\./);
if (roomID !== null && sensorID !== null) {
if (roomID !== null && sensorID !== null && state.val !== null) {
this.log.debug(`Room ${roomID[1]}: Calling setActualTemp(${roomID[1]}, ${sensorID[1]}, ${state.val})`);
this._setActualTemp(roomID[1], sensorID[1], state.val);
} else {
Expand All @@ -682,7 +682,7 @@ class Controme extends utils.adapter {
// extract the apiID and sensorID from id
const roomID = id.match(/^controme\.\d\.(\d+)/);
const apiID = id.match(/offsets\.[^.]+\.(.+)/);
if (roomID !== null && apiID !== null) {
if (roomID !== null && apiID !== null && state.val !== null) {
this.log.debug(`Room ${roomID[1]}: Calling setOffsetTemp(${roomID[1]}, ${apiID[1]}, ${state.val})`);
this._setOffsetTemp(roomID[1], apiID[1], state.val);
} else {
Expand Down

0 comments on commit ca103fe

Please sign in to comment.