Skip to content

Commit dcfe732

Browse files
committed
* (Apollon77) detect unknown appartment/zone states, so that adapter do not crash
1 parent 506c02a commit dcfe732

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/dssStructure.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,7 @@ class DSSStructure {
10521052
const stateName = state.matchedName;
10531053
let stateValue = state.state;
10541054
if (!dssConstants.apartmentStateRoleMap[stateName]) {
1055-
this.adapter.log.info('Can not create unknown Apartment State ' + state.matchedName + ': ' + JSON.stringify(state));
1055+
this.adapter.log.info('INVALID Apartment State ' + state.matchedName + ': ' + JSON.stringify(state));
10561056
return;
10571057
}
10581058
if (dssConstants.apartmentStateRoleMap[stateName].native) {
@@ -1182,7 +1182,12 @@ class DSSStructure {
11821182
const stateId = zoneBaseId + '.states.' + state.matchedName;
11831183
const stateName = state.matchedName;
11841184
let stateValue = state.state;
1185-
if (dssConstants.zoneStateRoleMap[stateName] && dssConstants.zoneStateRoleMap[stateName].native) {
1185+
if (!dssConstants.zoneStateRoleMap[stateName]) {
1186+
this.adapter.log.info('INVALID Zone State ' + state.matchedName + ': ' + JSON.stringify(state));
1187+
return;
1188+
}
1189+
1190+
if (dssConstants.zoneStateRoleMap[stateName].native) {
11861191
if (dssConstants.zoneStateRoleMap[stateName].native.valueTrue !== undefined && stateValue === dssConstants.zoneStateRoleMap[stateName].native.valueTrue) {
11871192
stateValue = true;
11881193
}

0 commit comments

Comments
 (0)