Skip to content

Commit 1860644

Browse files
committed
Apply OccupancySensor and OccupiedProperty types to occupancy sensors - closes #351
1 parent 464dcaf commit 1860644

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/zb-classifier.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,7 +1036,7 @@ class ZigbeeClassifier {
10361036
'occupied', // name
10371037
{
10381038
// property description
1039-
'@type': 'BooleanProperty',
1039+
'@type': 'OccupiedProperty',
10401040
type: 'boolean',
10411041
label: 'Occupied',
10421042
description: 'Occupancy Sensor',
@@ -1066,6 +1066,9 @@ class ZigbeeClassifier {
10661066
'', // setAttrFromValue
10671067
'parseOccupancySensorTypeAttr' // parseValueFromAttr
10681068
);
1069+
if (!node['@type'].includes('OccupancySensor')) {
1070+
node['@type'].push('OccupancySensor');
1071+
}
10691072
}
10701073

10711074
addIlluminanceMeasurementProperty(node, msMeasurementEndpoint) {
@@ -2120,6 +2123,9 @@ ${(`0${d.getHours()}`).slice(-2)}:${(`0${d.getMinutes()}`).slice(-2)}:${(`0${d.g
21202123
if (genPowerCfgEndpoint) {
21212124
this.addPowerCfgVoltageProperty(node, genPowerCfgEndpoint);
21222125
}
2126+
if (msOccupancySensingEndpoint) {
2127+
this.addOccupancySensorProperty(node, msOccupancySensingEndpoint);
2128+
}
21232129

21242130
this.addLastSeenProperty(node);
21252131
}
@@ -2215,7 +2221,7 @@ ${(`0${d.getHours()}`).slice(-2)}:${(`0${d.getMinutes()}`).slice(-2)}:${(`0${d.g
22152221
}
22162222

22172223
initOccupancySensor(node, msOccupancySensingEndpoint) {
2218-
node['@type'] = ['BinarySensor'];
2224+
node['@type'] = ['OccupancySensor'];
22192225
node.type = 'sensor';
22202226
node.name = `${node.id}-occupancy`;
22212227

0 commit comments

Comments
 (0)