mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-25 14:55:55 +01:00
[freeboxos] Use rpm as unit for fan sensors (#17198)
Also patch the label for hard disk sensor. Signed-off-by: Laurent Garnier <lg.hc@free.fr> Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
This commit is contained in:
parent
4e9d6d6890
commit
87611a59da
@ -39,7 +39,6 @@ import org.openhab.binding.freeboxos.internal.api.rest.SystemManager;
|
||||
import org.openhab.binding.freeboxos.internal.api.rest.SystemManager.Config;
|
||||
import org.openhab.binding.freeboxos.internal.api.rest.UPnPAVManager;
|
||||
import org.openhab.binding.freeboxos.internal.api.rest.WifiManager;
|
||||
import org.openhab.core.library.CoreItemFactory;
|
||||
import org.openhab.core.library.types.QuantityType;
|
||||
import org.openhab.core.library.unit.SIUnits;
|
||||
import org.openhab.core.library.unit.Units;
|
||||
@ -87,17 +86,22 @@ public class ServerHandler extends ApiConsumerHandler implements FreeDeviceIntf
|
||||
config.sensors().forEach(sensor -> {
|
||||
ChannelUID sensorId = new ChannelUID(thing.getUID(), GROUP_SENSORS, sensor.id());
|
||||
if (getThing().getChannel(sensorId) == null) {
|
||||
channels.add(ChannelBuilder.create(sensorId).withLabel(sensor.name())
|
||||
.withAcceptedItemType("Number:Temperature")
|
||||
.withType(new ChannelTypeUID(BINDING_ID + ":temperature")).build());
|
||||
String label = sensor.name();
|
||||
// For revolution, API returns only "Disque dur" so we patch it to have naming consistency with other
|
||||
// temperature sensors
|
||||
if ("Disque dur".equals(label)) {
|
||||
label = "Température " + label;
|
||||
}
|
||||
channels.add(ChannelBuilder.create(sensorId).withLabel(label).withAcceptedItemType("Number:Temperature")
|
||||
.withType(new ChannelTypeUID(BINDING_ID, "temperature")).build());
|
||||
}
|
||||
});
|
||||
config.fans().forEach(sensor -> {
|
||||
ChannelUID sensorId = new ChannelUID(thing.getUID(), GROUP_FANS, sensor.id());
|
||||
if (getThing().getChannel(sensorId) == null) {
|
||||
channels.add(ChannelBuilder.create(sensorId).withLabel(sensor.name())
|
||||
.withAcceptedItemType(CoreItemFactory.NUMBER)
|
||||
.withType(new ChannelTypeUID(BINDING_ID + ":fanspeed")).build());
|
||||
.withAcceptedItemType("Number:Frequency").withType(new ChannelTypeUID(BINDING_ID, "fanspeed"))
|
||||
.build());
|
||||
}
|
||||
});
|
||||
if (nbInit != channels.size()) {
|
||||
|
@ -75,11 +75,11 @@
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="fanspeed" advanced="true">
|
||||
<item-type>Number:Frequency</item-type>
|
||||
<item-type unitHint="rpm">Number:Frequency</item-type>
|
||||
<label>Fan Speed</label>
|
||||
<description>Actual measured rotation speed of the fan</description>
|
||||
<category>Fan</category>
|
||||
<state readOnly="true" pattern="%d %unit%"/>
|
||||
<state readOnly="true" pattern="%d rpm"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="samba-file-status" advanced="true">
|
||||
|
Loading…
Reference in New Issue
Block a user