Add operation channels (#18582)

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
pull/18584/head
Jacob Laursen 2025-04-21 16:25:55 +02:00 committed by GitHub
parent 6996dc8b57
commit 7c918e7a21
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 65 additions and 10 deletions

View File

@ -38,12 +38,14 @@ These are the available configuration parameters:
| humidity | humidity | Number:Dimensionless | RO | Current relative humidity measured by the air unit |
| bypass | recuperator | Switch | RW | Disables the heat exchange. Useful in summer when room temperature is above target and outside temperature is below target. |
| defrost | recuperator | Switch | RO | Defrost status. Active when low outdoor temperatures pose a risk of ice formation in the heat exchanger. |
| supply_temp | recuperator | Number | RO | Temperature of air which is passed to the rooms |
| extract_temp | recuperator | Number | RO | Temperature of the air as extracted from the rooms |
| exhaust_temp | recuperator | Number | RO | Temperature of the air when pushed outside |
| supply_temp | recuperator | Number:Temperature | RO | Temperature of air which is passed to the rooms |
| extract_temp | recuperator | Number:Temperature | RO | Temperature of the air as extracted from the rooms |
| exhaust_temp | recuperator | Number:Temperature | RO | Temperature of the air when pushed outside |
| battery_life | service | Number | RO | Remaining Air Dial Battery Level (percentage) |
| filter_life | service | Number | RO | Remaining life of filter until exchange is necessary (percentage) |
| filter_period | service | Number | RW | Number of months between filter replacements (between 3 and 12). This value affects calculation of filter_life by the unit, and might get overwritten by Air Dial or Link CC Controller. |
| power_cycles | operation | Number | RO | The total count of power cycles, indicating how many times the unit has been turned off and on again. |
| operating_hours | operation | Number:Time | RO | The number of hours the unit has been in operation (in minutes). |
## Full Example

View File

@ -25,7 +25,6 @@ import org.eclipse.jdt.annotation.Nullable;
public enum Channel {
// Main Channels
CHANNEL_CURRENT_TIME("current_time", ChannelGroup.MAIN, DanfossAirUnit::getCurrentTime),
CHANNEL_MODE("mode", ChannelGroup.MAIN, DanfossAirUnit::getMode, DanfossAirUnit::setMode),
CHANNEL_MANUAL_FAN_STEP("manual_fan_step", ChannelGroup.MAIN, DanfossAirUnit::getManualFanStep,
@ -34,7 +33,6 @@ public enum Channel {
CHANNEL_SUPPLY_FAN_SPEED("supply_fan_speed", ChannelGroup.MAIN, DanfossAirUnit::getSupplyFanSpeed),
CHANNEL_EXTRACT_FAN_STEP("extract_fan_step", ChannelGroup.MAIN, DanfossAirUnit::getExtractFanStep),
CHANNEL_SUPPLY_FAN_STEP("supply_fan_step", ChannelGroup.MAIN, DanfossAirUnit::getSupplyFanStep),
CHANNEL_BOOST("boost", ChannelGroup.MAIN, DanfossAirUnit::getBoost, DanfossAirUnit::setBoost),
CHANNEL_NIGHT_COOLING("night_cooling", ChannelGroup.MAIN, DanfossAirUnit::getNightCooling,
DanfossAirUnit::setNightCooling),
@ -48,18 +46,22 @@ public enum Channel {
// Humidity Channel
CHANNEL_HUMIDITY("humidity", ChannelGroup.HUMIDITY, DanfossAirUnit::getHumidity),
// recuperator channels
// Recuperator channels
CHANNEL_BYPASS("bypass", ChannelGroup.RECUPERATOR, DanfossAirUnit::getBypass, DanfossAirUnit::setBypass),
CHANNEL_DEFROST("defrost", ChannelGroup.RECUPERATOR, DanfossAirUnit::getDefrostStatus),
CHANNEL_SUPPLY_TEMP("supply_temp", ChannelGroup.RECUPERATOR, DanfossAirUnit::getSupplyTemperature),
CHANNEL_EXTRACT_TEMP("extract_temp", ChannelGroup.RECUPERATOR, DanfossAirUnit::getExtractTemperature),
CHANNEL_EXHAUST_TEMP("exhaust_temp", ChannelGroup.RECUPERATOR, DanfossAirUnit::getExhaustTemperature),
// service channels
// Service channels
CHANNEL_BATTERY_LIFE("battery_life", ChannelGroup.SERVICE, DanfossAirUnit::getBatteryLife),
CHANNEL_FILTER_LIFE("filter_life", ChannelGroup.SERVICE, DanfossAirUnit::getFilterLife),
CHANNEL_FILTER_PERIOD("filter_period", ChannelGroup.SERVICE, DanfossAirUnit::getFilterPeriod,
DanfossAirUnit::setFilterPeriod);
DanfossAirUnit::setFilterPeriod),
// Operation channels
CHANNEL_POWER_CYCLES("power_cycles", ChannelGroup.OPERATION, DanfossAirUnit::getPowerCycles),
CHANNEL_OPERATING_HOURS("operating_hours", ChannelGroup.OPERATION, DanfossAirUnit::getOperationTime);
private final String channelName;
private final ChannelGroup group;

View File

@ -25,7 +25,8 @@ public enum ChannelGroup {
TEMPS("temps"),
HUMIDITY("humidity"),
RECUPERATOR("recuperator"),
SERVICE("service");
SERVICE("service"),
OPERATION("operation");
private final String groupName;

View File

@ -23,6 +23,7 @@ import java.time.ZonedDateTime;
import javax.measure.quantity.Dimensionless;
import javax.measure.quantity.Frequency;
import javax.measure.quantity.Temperature;
import javax.measure.quantity.Time;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.binding.danfossairunit.internal.protocol.Parameter;
@ -257,6 +258,14 @@ public class DanfossAirUnit {
return new DateTimeType(timestamp);
}
public QuantityType<Time> getOperationTime() throws IOException, UnexpectedResponseValueException {
return new QuantityType<>(getInt(Parameter.OPERATION_TIME), Units.MINUTE);
}
public DecimalType getPowerCycles() throws IOException {
return new DecimalType(BigDecimal.valueOf(getByte(Parameter.POWER_CYCLE_COUNTER)));
}
public PercentType setManualFanStep(Command cmd) throws IOException {
return setPercentTypeRegister(cmd, Parameter.MANUAL_FAN_SPEED_STEP);
}

View File

@ -22,6 +22,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
@NonNullByDefault
public enum Parameter {
CCM_SERIAL_NUMBER(Endpoint.ENDPOINT_0, Flag.READ, (short) 22),
OPERATION_TIME(Endpoint.ENDPOINT_0, Flag.READ, (short) 992),
ROOM_TEMPERATURE_CALCULATED(Endpoint.ENDPOINT_0, Flag.READ, (short) 5270),
ROOM_TEMPERATURE(Endpoint.ENDPOINT_1, Flag.READ, (short) 768),
BATTERY_LIFE(Endpoint.ENDPOINT_1, Flag.READ, (short) 783),
@ -40,6 +41,7 @@ public enum Parameter {
UNIT_HARDWARE_REVISION(Endpoint.ENDPOINT_4, Flag.READ, (short) 34),
UNIT_SOFTWARE_REVISION(Endpoint.ENDPOINT_4, Flag.READ, (short) 35),
UNIT_SERIAL(Endpoint.ENDPOINT_4, Flag.READ, (short) 37),
POWER_CYCLE_COUNTER(Endpoint.ENDPOINT_4, Flag.READ, (short) 5125),
SUPPLY_FAN_STEP(Endpoint.ENDPOINT_4, Flag.READ, (short) 5160),
EXTRACT_FAN_STEP(Endpoint.ENDPOINT_4, Flag.READ, (short) 5161),
SUPPLY_FAN_SPEED(Endpoint.ENDPOINT_4, Flag.READ, (short) 5200),

View File

@ -25,6 +25,7 @@ channel-group-type.danfossairunit.humidity.label = Humidity
channel-group-type.danfossairunit.humidity.channel.humidity.label = Humidity
channel-group-type.danfossairunit.humidity.channel.humidity.description = Current relative humidity measured by the air unit
channel-group-type.danfossairunit.main.label = Mode and Fan Speeds
channel-group-type.danfossairunit.operation.label = Operation
channel-group-type.danfossairunit.recuperator.label = Recuperator
channel-group-type.danfossairunit.recuperator.description = Heat exchaning device in the Air Unit
channel-group-type.danfossairunit.recuperator.channel.exhaust_temp.label = Exhaust Air Temperature
@ -72,6 +73,10 @@ channel-type.danfossairunit.mode.state.option.MANUAL = Manual
channel-type.danfossairunit.mode.state.option.OFF = Off
channel-type.danfossairunit.night-cooling.label = Night Cooling
channel-type.danfossairunit.night-cooling.description = Enables night cooling
channel-type.danfossairunit.operating-hours.label = Operating Hours
channel-type.danfossairunit.operating-hours.description = The number of hours the unit has been in operation (in minutes)
channel-type.danfossairunit.power-cycles.label = Power Cycles
channel-type.danfossairunit.power-cycles.description = The total count of power cycles, indicating how many times the unit has been turned off and on again
channel-type.danfossairunit.supplyFanSpeed.label = Supply Fan Speed
channel-type.danfossairunit.supplyFanSpeed.description = Current rotation of the fan supplying air to the rooms
channel-type.danfossairunit.supplyFanStep.label = Supply Fan Step

View File

@ -15,11 +15,12 @@
<channel-group id="humidity" typeId="humidity"/>
<channel-group id="recuperator" typeId="recuperator"/>
<channel-group id="service" typeId="service"/>
<channel-group id="operation" typeId="operation"/>
</channel-groups>
<properties>
<property name="vendor">Danfoss</property>
<property name="thingTypeVersion">4</property>
<property name="thingTypeVersion">5</property>
</properties>
<representation-property>serialNumber</representation-property>
@ -127,6 +128,14 @@
</channels>
</channel-group-type>
<channel-group-type id="operation">
<label>Operation</label>
<channels>
<channel id="power_cycles" typeId="power-cycles"/>
<channel id="operating_hours" typeId="operating-hours"/>
</channels>
</channel-group-type>
<!--Channel Definitions -->
<channel-type id="currentTime">
<item-type>DateTime</item-type>
@ -238,6 +247,7 @@
<category>Temperature</category>
<state readOnly="true" pattern="%.1f %unit%"/>
</channel-type>
<channel-type id="defrost" advanced="true">
<item-type>Switch</item-type>
<label>Defrost</label>
@ -245,4 +255,19 @@
<state readOnly="true"/>
</channel-type>
<channel-type id="power-cycles">
<item-type>Number</item-type>
<label>Power Cycles</label>
<description>The total count of power cycles, indicating how many times the unit has been turned off and on again</description>
<state readOnly="true"/>
</channel-type>
<channel-type id="operating-hours">
<item-type unitHint="min">Number:Time</item-type>
<label>Operating Hours</label>
<description>The number of hours the unit has been in operation (in minutes)</description>
<category>Time</category>
<state pattern="%1$tdd %1$tHh %1$tMm" readOnly="true"/>
</channel-type>
</thing:thing-descriptions>

View File

@ -79,6 +79,15 @@
</update-channel>
</instruction-set>
<instruction-set targetVersion="5">
<add-channel id="power_cycles" groupIds="operation">
<type>danfossairunit:power-cycles</type>
</add-channel>
<add-channel id="operating_hours" groupIds="operation">
<type>danfossairunit:operating-hours</type>
</add-channel>
</instruction-set>
</thing-type>
</update:update-descriptions>