[deconz] Pimp channel types with proper categories (#9513)
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
This commit is contained in:
parent
46f91813a8
commit
b2f6202b25
@ -237,6 +237,14 @@ public class ThingDiscoveryService extends AbstractDiscoveryService implements D
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ThingTypeUID thingTypeUID;
|
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
|
if (sensor.type.contains("Daylight")) { // deCONZ specific: Software simulated daylight sensor
|
||||||
thingTypeUID = THING_TYPE_DAYLIGHT_SENSOR;
|
thingTypeUID = THING_TYPE_DAYLIGHT_SENSOR;
|
||||||
} else if (sensor.type.contains("Power")) { // ZHAPower, CLIPPower
|
} else if (sensor.type.contains("Power")) { // ZHAPower, CLIPPower
|
||||||
@ -281,8 +289,8 @@ public class ThingDiscoveryService extends AbstractDiscoveryService implements D
|
|||||||
ThingUID uid = new ThingUID(thingTypeUID, bridgeUID, sensor.uniqueid.replaceAll("[^a-z0-9\\[\\]]", ""));
|
ThingUID uid = new ThingUID(thingTypeUID, bridgeUID, sensor.uniqueid.replaceAll("[^a-z0-9\\[\\]]", ""));
|
||||||
|
|
||||||
DiscoveryResult discoveryResult = DiscoveryResultBuilder.create(uid).withBridge(bridgeUID)
|
DiscoveryResult discoveryResult = DiscoveryResultBuilder.create(uid).withBridge(bridgeUID)
|
||||||
.withLabel(sensor.name + " (" + sensor.manufacturername + ")").withProperty(CONFIG_ID, sensorID)
|
.withLabel(sensor.name + " (" + sensor.manufacturername + ")").withProperties(properties)
|
||||||
.withProperty(UNIQUE_ID, sensor.uniqueid).withRepresentationProperty(UNIQUE_ID).build();
|
.withRepresentationProperty(UNIQUE_ID).build();
|
||||||
thingDiscovered(discoveryResult);
|
thingDiscovered(discoveryResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -127,9 +127,10 @@ public abstract class SensorBaseThingHandler extends DeconzBaseThingHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Map<String, String> editProperties = editProperties();
|
Map<String, String> editProperties = editProperties();
|
||||||
editProperties.put(Thing.PROPERTY_FIRMWARE_VERSION, sensorMessage.swversion);
|
|
||||||
editProperties.put(Thing.PROPERTY_MODEL_ID, sensorMessage.modelid);
|
|
||||||
editProperties.put(UNIQUE_ID, sensorMessage.uniqueid);
|
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);
|
||||||
ignoreConfigurationUpdate = true;
|
ignoreConfigurationUpdate = true;
|
||||||
updateProperties(editProperties);
|
updateProperties(editProperties);
|
||||||
|
|
||||||
|
|||||||
@ -11,7 +11,7 @@
|
|||||||
<label>Presence Sensor</label>
|
<label>Presence Sensor</label>
|
||||||
<description>A Presence sensor</description>
|
<description>A Presence sensor</description>
|
||||||
<channels>
|
<channels>
|
||||||
<channel typeId="presence" id="presence"/>
|
<channel typeId="system.motion" id="presence"/>
|
||||||
<channel typeId="last_updated" id="last_updated"/>
|
<channel typeId="last_updated" id="last_updated"/>
|
||||||
</channels>
|
</channels>
|
||||||
|
|
||||||
@ -20,13 +20,6 @@
|
|||||||
<config-description-ref uri="thing-type:deconz:sensor"/>
|
<config-description-ref uri="thing-type:deconz:sensor"/>
|
||||||
</thing-type>
|
</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">
|
<channel-type id="last_updated">
|
||||||
<item-type>DateTime</item-type>
|
<item-type>DateTime</item-type>
|
||||||
<label>Last Updated</label>
|
<label>Last Updated</label>
|
||||||
@ -469,7 +462,7 @@
|
|||||||
<label>Battery Sensor</label>
|
<label>Battery Sensor</label>
|
||||||
<description>A battery sensor</description>
|
<description>A battery sensor</description>
|
||||||
<channels>
|
<channels>
|
||||||
<channel typeId="battery" id="battery_level"/>
|
<channel typeId="system.battery-level" id="battery_level"/>
|
||||||
<channel typeId="last_updated" id="last_updated"/>
|
<channel typeId="last_updated" id="last_updated"/>
|
||||||
</channels>
|
</channels>
|
||||||
|
|
||||||
@ -478,13 +471,6 @@
|
|||||||
<config-description-ref uri="thing-type:deconz:sensor"/>
|
<config-description-ref uri="thing-type:deconz:sensor"/>
|
||||||
</thing-type>
|
</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">
|
<thing-type id="carbonmonoxidesensor">
|
||||||
<supported-bridge-type-refs>
|
<supported-bridge-type-refs>
|
||||||
<bridge-type-ref id="deconz"/>
|
<bridge-type-ref id="deconz"/>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user