[hdpowerview] Add new batteryVoltage channel (#11155)

* Add new batteryVoltage channel.

Fixes #11154

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>

* Fix documentation for lowBattery.

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>

* Organized channels into two groups: Shade and Battery.

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>

* Revert breaking change.

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
jlaur 2021-08-26 18:57:27 +02:00 committed by GitHub
parent 36377a790e
commit 4e50a985e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 6 deletions

View File

@ -74,11 +74,12 @@ If it is a dual action (top-down plus bottom-up) shade, there is also a roller s
All of these channels appear in the binding, but only those which have a physical implementation in the shade, will have any physical effect.
| Channel | Item Type | Description |
|------------|---------------|------------|
|----------------|--------------------------|------------|
| position | Rollershutter | The vertical position of the shade's rail -- see [next chapter](#Roller-Shutter-Up/Down-Position-vs.-Open/Close-State). Up/Down commands will move the rail completely up or completely down. Percentage commands will move the rail to an intermediate position. Stop commands will halt any current movement of the rail. |
| secondary | Rollershutter | The vertical position of the secondary rail (if any). Its function is basically identical to the `position` channel above -- but see [next chapter](#Roller-Shutter-Up/Down-Position-vs.-Open/Close-State). |
| vane | Dimmer | The degree of opening of the slats or vanes. Setting this to a non-zero value will first move the shade `position` fully down, since the slats or vanes can only have a defined state if the shade is in its down position -- see [Interdependency between Channel positions](#Interdependency-between-Channel-positions). |
| batteryLow | Switch | Indicates ON when the battery level of the shade is low, as determined by the hub's internal rules. |
| lowBattery | Switch | Indicates ON when the battery level of the shade is low, as determined by the hub's internal rules. |
| batteryVoltage | Number:ElectricPotential | Battery voltage reported by the shade. |
### Roller Shutter Up/Down Position vs. Open/Close State

View File

@ -40,6 +40,7 @@ public class HDPowerViewBindingConstants {
public static final String CHANNEL_SHADE_POSITION = "position";
public static final String CHANNEL_SHADE_VANE = "vane";
public static final String CHANNEL_SHADE_LOW_BATTERY = "lowBattery";
public static final String CHANNEL_SHADE_BATTERY_VOLTAGE = "batteryVoltage";
public static final String CHANNEL_SHADE_SECONDARY_POSITION = "secondary";
public static final String CHANNELTYPE_SCENE_ACTIVATE = "scene-activate";

View File

@ -32,8 +32,10 @@ import org.openhab.binding.hdpowerview.internal.api.responses.Shades.ShadeData;
import org.openhab.binding.hdpowerview.internal.config.HDPowerViewShadeConfiguration;
import org.openhab.core.library.types.OnOffType;
import org.openhab.core.library.types.PercentType;
import org.openhab.core.library.types.QuantityType;
import org.openhab.core.library.types.StopMoveType;
import org.openhab.core.library.types.UpDownType;
import org.openhab.core.library.unit.Units;
import org.openhab.core.thing.ChannelUID;
import org.openhab.core.thing.Thing;
import org.openhab.core.thing.ThingStatus;
@ -135,6 +137,7 @@ public class HDPowerViewShadeHandler extends AbstractHubbedThingHandler {
updateStatus(ThingStatus.ONLINE);
updateBindingStates(shadeData.positions);
updateState(CHANNEL_SHADE_LOW_BATTERY, shadeData.batteryStatus < 2 ? OnOffType.ON : OnOffType.OFF);
updateState(CHANNEL_SHADE_BATTERY_VOLTAGE, new QuantityType<>(shadeData.batteryStrength / 10, Units.VOLT));
} else {
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR);
}

View File

@ -48,6 +48,7 @@
</channel>
<channel id="vane" typeId="shade-vane"/>
<channel id="lowBattery" typeId="system.low-battery"/>
<channel id="batteryVoltage" typeId="battery-voltage"/>
</channels>
<properties>
@ -82,4 +83,11 @@
<description>Activates the scene</description>
</channel-type>
<channel-type id="battery-voltage" advanced="true">
<item-type>Number:ElectricPotential</item-type>
<label>Battery Voltage</label>
<description>Battery voltage reported by the shade</description>
<state pattern="%.1f %unit%" readOnly="true"/>
</channel-type>
</thing:thing-descriptions>