Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing UoMs #597

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion org.openhab.binding.zigbee/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ The following channels are supported -:
| ias_movement | ```IAS_ZONE``` (0x0500) | Switch | |
| ias_vibration | ```IAS_ZONE``` (0x0500) | Switch | |
| ias_tamper | ```IAS_ZONE``` (0x0500) | Switch | |
| measurement_illuminance | ```ILLUMINANCE_MEASUREMENT``` (0x0400) | Number | |
| measurement_illuminance | ```ILLUMINANCE_MEASUREMENT``` (0x0400) | Number:Illuminance | |
| measurement_pressure | ```PRESSURE_MEASUREMENT``` (0x0403) | Number:Pressure | |
| measurement_relativehumidity | ```RELATIVE_HUMIDITY_MEASUREMENT``` (0x0405) | Number | |
| measurement_temperature | ```TEMPERATURE_MEASUREMENT``` (0x0402) | Number:Temperature | |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@ public class ZigBeeBindingConstants {
public static final String ITEM_TYPE_CONTACT = "Contact";
public static final String ITEM_TYPE_DIMMER = "Dimmer";
public static final String ITEM_TYPE_NUMBER = "Number";
public static final String ITEM_TYPE_NUMBER_ELECTRICCURRENT = "Number:ElectricCurrent";
public static final String ITEM_TYPE_NUMBER_ELECTRICPOTENTIAL = "Number:ElectricPotential";
public static final String ITEM_TYPE_NUMBER_ILLUMINANCE = "Number:Illuminance";
public static final String ITEM_TYPE_NUMBER_POWER = "Number:Power";
public static final String ITEM_TYPE_NUMBER_PRESSURE = "Number:Pressure";
public static final String ITEM_TYPE_NUMBER_TEMPERATURE = "Number:Temperature";
public static final String ITEM_TYPE_ROLLERSHUTTER = "Rollershutter";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public Channel getChannel(ThingUID thingUID, ZigBeeEndpoint endpoint) {

return ChannelBuilder
.create(createChannelUID(thingUID, endpoint, ZigBeeBindingConstants.CHANNEL_NAME_POWER_BATTERYVOLTAGE),
ZigBeeBindingConstants.ITEM_TYPE_NUMBER)
ZigBeeBindingConstants.ITEM_TYPE_NUMBER_ELECTRICPOTENTIAL)
.withType(ZigBeeBindingConstants.CHANNEL_POWER_BATTERYVOLTAGE)
.withLabel(ZigBeeBindingConstants.CHANNEL_LABEL_POWER_BATTERYVOLTAGE)
.withProperties(createProperties(endpoint)).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.smarthome.config.core.Configuration;
import org.eclipse.smarthome.core.library.types.DecimalType;
import org.eclipse.smarthome.core.library.types.QuantityType;
import org.eclipse.smarthome.core.library.unit.SmartHomeUnits;
import org.eclipse.smarthome.core.thing.Channel;
import org.eclipse.smarthome.core.thing.ThingUID;
import org.eclipse.smarthome.core.thing.binding.builder.ChannelBuilder;
Expand Down Expand Up @@ -161,7 +163,7 @@ public Channel getChannel(ThingUID thingUID, ZigBeeEndpoint endpoint) {
}
return ChannelBuilder
.create(createChannelUID(thingUID, endpoint, ZigBeeBindingConstants.CHANNEL_NAME_ILLUMINANCE_VALUE),
ZigBeeBindingConstants.ITEM_TYPE_NUMBER)
ZigBeeBindingConstants.ITEM_TYPE_NUMBER_ILLUMINANCE)
.withType(ZigBeeBindingConstants.CHANNEL_ILLUMINANCE_VALUE)
.withLabel(ZigBeeBindingConstants.CHANNEL_LABEL_ILLUMINANCE_VALUE)
.withProperties(createProperties(endpoint)).build();
Expand All @@ -172,7 +174,7 @@ public void attributeUpdated(ZclAttribute attribute, Object val) {
logger.debug("{}: ZigBee attribute reports {}", endpoint.getIeeeAddress(), attribute);
if (attribute.getCluster() == ZclClusterType.ILLUMINANCE_MEASUREMENT
&& attribute.getId() == ZclIlluminanceMeasurementCluster.ATTR_MEASUREDVALUE) {
updateChannelState(new DecimalType(Math.pow(10.0, (Integer) val / 10000.0) - 1));
updateChannelState(new QuantityType<>(new DecimalType(Math.pow(10.0, (Integer) val / 10000.0) - 1), SmartHomeUnits.LUX));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public Channel getChannel(ThingUID thingUID, ZigBeeEndpoint endpoint) {
return ChannelBuilder
.create(createChannelUID(thingUID, endpoint,
ZigBeeBindingConstants.CHANNEL_NAME_ELECTRICAL_ACTIVEPOWER),
ZigBeeBindingConstants.ITEM_TYPE_NUMBER)
ZigBeeBindingConstants.ITEM_TYPE_NUMBER_POWER)
.withType(ZigBeeBindingConstants.CHANNEL_ELECTRICAL_ACTIVEPOWER)
.withLabel(ZigBeeBindingConstants.CHANNEL_LABEL_ELECTRICAL_ACTIVEPOWER)
.withProperties(createProperties(endpoint)).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public Channel getChannel(ThingUID thingUID, ZigBeeEndpoint endpoint) {

return ChannelBuilder
.create(createChannelUID(thingUID, endpoint, ZigBeeBindingConstants.CHANNEL_NAME_ELECTRICAL_RMSCURRENT),
ZigBeeBindingConstants.ITEM_TYPE_NUMBER)
ZigBeeBindingConstants.ITEM_TYPE_NUMBER_ELECTRICCURRENT)
.withType(ZigBeeBindingConstants.CHANNEL_ELECTRICAL_RMSCURRENT)
.withLabel(ZigBeeBindingConstants.CHANNEL_LABEL_ELECTRICAL_RMSCURRENT)
.withProperties(createProperties(endpoint)).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public Channel getChannel(ThingUID thingUID, ZigBeeEndpoint endpoint) {

return ChannelBuilder
.create(createChannelUID(thingUID, endpoint, ZigBeeBindingConstants.CHANNEL_NAME_ELECTRICAL_RMSVOLTAGE),
ZigBeeBindingConstants.ITEM_TYPE_NUMBER)
ZigBeeBindingConstants.ITEM_TYPE_NUMBER_ELECTRICPOTENTIAL)
.withType(ZigBeeBindingConstants.CHANNEL_ELECTRICAL_RMSVOLTAGE)
.withLabel(ZigBeeBindingConstants.CHANNEL_LABEL_ELECTRICAL_RMSVOLTAGE)
.withProperties(createProperties(endpoint)).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,11 @@

<!-- Illuminance Channel -->
<channel-type id="measurement_illuminance">
<item-type>Number</item-type>
<item-type>Number:Illuminance</item-type>
<label>Illuminance</label>
<description>Indicates the current illuminance in lux</description>
<description>Indicates the current illuminance</description>
<category></category>
<state pattern="%.0f" readOnly="true" />
<state pattern="%.0f %unit%" readOnly="true" />
</channel-type>

<!-- Atmospheric Pressure Channel -->
Expand Down