return;
}
ThingTypeUID thingTypeUID;
+
+ Map<String, Object> properties = new HashMap<>();
+ properties.put(CONFIG_ID, sensorID);
+ properties.put(UNIQUE_ID, sensor.uniqueid);
+ properties.put(Thing.PROPERTY_FIRMWARE_VERSION, sensor.swversion);
+ properties.put(Thing.PROPERTY_VENDOR, sensor.manufacturername);
+ properties.put(Thing.PROPERTY_MODEL_ID, sensor.modelid);
+
if (sensor.type.contains("Daylight")) { // deCONZ specific: Software simulated daylight sensor
thingTypeUID = THING_TYPE_DAYLIGHT_SENSOR;
} else if (sensor.type.contains("Power")) { // ZHAPower, CLIPPower
ThingUID uid = new ThingUID(thingTypeUID, bridgeUID, sensor.uniqueid.replaceAll("[^a-z0-9\\[\\]]", ""));
DiscoveryResult discoveryResult = DiscoveryResultBuilder.create(uid).withBridge(bridgeUID)
- .withLabel(sensor.name + " (" + sensor.manufacturername + ")").withProperty(CONFIG_ID, sensorID)
- .withProperty(UNIQUE_ID, sensor.uniqueid).withRepresentationProperty(UNIQUE_ID).build();
+ .withLabel(sensor.name + " (" + sensor.manufacturername + ")").withProperties(properties)
+ .withRepresentationProperty(UNIQUE_ID).build();
thingDiscovered(discoveryResult);
}
}
Map<String, String> editProperties = editProperties();
+ editProperties.put(UNIQUE_ID, sensorMessage.uniqueid);
editProperties.put(Thing.PROPERTY_FIRMWARE_VERSION, sensorMessage.swversion);
+ editProperties.put(Thing.PROPERTY_VENDOR, sensorMessage.manufacturername);
editProperties.put(Thing.PROPERTY_MODEL_ID, sensorMessage.modelid);
- editProperties.put(UNIQUE_ID, sensorMessage.uniqueid);
ignoreConfigurationUpdate = true;
updateProperties(editProperties);
<label>Presence Sensor</label>
<description>A Presence sensor</description>
<channels>
- <channel typeId="presence" id="presence"/>
+ <channel typeId="system.motion" id="presence"/>
<channel typeId="last_updated" id="last_updated"/>
</channels>
<config-description-ref uri="thing-type:deconz:sensor"/>
</thing-type>
- <channel-type id="presence">
- <item-type>Switch</item-type>
- <label>Presence</label>
- <description>Presence detected</description>
- <state readOnly="true"></state>
- </channel-type>
-
<channel-type id="last_updated">
<item-type>DateTime</item-type>
<label>Last Updated</label>
<label>Battery Sensor</label>
<description>A battery sensor</description>
<channels>
- <channel typeId="battery" id="battery_level"/>
+ <channel typeId="system.battery-level" id="battery_level"/>
<channel typeId="last_updated" id="last_updated"/>
</channels>
<config-description-ref uri="thing-type:deconz:sensor"/>
</thing-type>
- <channel-type id="battery">
- <item-type>Number</item-type>
- <label>Battery</label>
- <description>The battery state.</description>
- <state pattern="%d %%" readOnly="true"/>
- </channel-type>
-
<thing-type id="carbonmonoxidesensor">
<supported-bridge-type-refs>
<bridge-type-ref id="deconz"/>