[avmfritz] Use system channel types and decrease minimum polling interval (#14587)

* Use system default channel types
* Changed minimum polling interval to 1s

Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
This commit is contained in:
Christoph Weitkamp 2023-03-23 22:55:01 +01:00 committed by GitHub
parent 7bddeb4a7f
commit 5e17f1dfbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 332 additions and 86 deletions

View File

@ -141,7 +141,7 @@ If correct credentials are set in the bridge configuration, connected AHA device
- `port` (optional, 1 to 65535), no default (derived from protocol: 80 or 443)
- `password` (optional for call monitoring, but mandatory for AHA features), no default (depends on FRITZ!Box security configuration)
- `user` (optional), no default (depends on FRITZ!Box security configuration)
- `pollingInterval` (optional, 5 to 60), default 15 (in seconds)
- `pollingInterval` (optional, 1 to 60), default 15 (in seconds)
- `asyncTimeout` (optional, 1000 to 60000), default 10000 (in milliseconds)
- `syncTimeout` (optional, 500 to 15000), default 2000 (in milliseconds)
@ -152,7 +152,7 @@ If correct credentials are set in the bridge configuration, connected AHA device
- `protocol` (optional, "http" or "https"), default "http"
- `port` (optional, 1 to 65535), no default (derived from protocol: 80 or 443)
- `password` (optional), no default (depends on FRITZ!Powerline security configuration)
- `pollingInterval` (optional, 5 to 60), default 15 (in seconds)
- `pollingInterval` (optional, 1 to 60), default 15 (in seconds)
- `asyncTimeout` (optional, 1000 to 60000), default 10000 (in milliseconds)
- `syncTimeout` (optional, 500 to 15000), default 2000 (in milliseconds)

View File

@ -79,7 +79,7 @@ public abstract class AVMFritzBaseBridgeHandler extends BaseBridgeHandler {
/**
* Refresh interval which is used to poll values from the FRITZ!Box web interface (optional, defaults to 15 s)
*/
private long refreshInterval = 15;
private long pollingInterval = 15;
/**
* Interface object for querying the FRITZ!Box web interface
@ -131,10 +131,10 @@ public abstract class AVMFritzBaseBridgeHandler extends BaseBridgeHandler {
"The 'ipAddress' parameter must be configured.");
configValid = false;
}
refreshInterval = config.pollingInterval;
if (refreshInterval < 5) {
pollingInterval = config.pollingInterval;
if (pollingInterval < 1) {
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR,
"The 'pollingInterval' parameter must be greater then at least 5 seconds.");
"The 'pollingInterval' parameter must be greater than or equals to 1 second.");
configValid = false;
}
@ -203,8 +203,8 @@ public abstract class AVMFritzBaseBridgeHandler extends BaseBridgeHandler {
protected void startPolling() {
ScheduledFuture<?> localPollingJob = pollingJob;
if (localPollingJob == null || localPollingJob.isCancelled()) {
logger.debug("Start polling job at interval {}s", refreshInterval);
pollingJob = scheduler.scheduleWithFixedDelay(this::poll, INITIAL_DELAY, refreshInterval, TimeUnit.SECONDS);
logger.debug("Start polling job at interval {}s", pollingInterval);
pollingJob = scheduler.scheduleWithFixedDelay(this::poll, INITIAL_DELAY, pollingInterval, TimeUnit.SECONDS);
}
}

View File

@ -335,8 +335,19 @@ public abstract class AVMFritzBaseThingHandler extends BaseThingHandler implemen
private ChannelTypeUID createChannelTypeUID(String channelId) {
int pos = channelId.indexOf(ChannelUID.CHANNEL_GROUP_SEPARATOR);
String id = pos > -1 ? channelId.substring(pos + 1) : channelId;
return CHANNEL_BATTERY.equals(id) ? DefaultSystemChannelTypeProvider.SYSTEM_CHANNEL_BATTERY_LEVEL.getUID()
: new ChannelTypeUID(BINDING_ID, id);
final ChannelTypeUID channelTypeUID;
switch (id) {
case CHANNEL_BATTERY:
channelTypeUID = DefaultSystemChannelTypeProvider.SYSTEM_CHANNEL_BATTERY_LEVEL.getUID();
break;
case CHANNEL_VOLTAGE:
channelTypeUID = DefaultSystemChannelTypeProvider.SYSTEM_ELECTRIC_VOLTAGE.getUID();
break;
default:
channelTypeUID = new ChannelTypeUID(BINDING_ID, id);
break;
}
return channelTypeUID;
}
/**
@ -347,9 +358,9 @@ public abstract class AVMFritzBaseThingHandler extends BaseThingHandler implemen
private void createChannel(String channelId) {
ThingHandlerCallback callback = getCallback();
if (callback != null) {
ChannelUID channelUID = new ChannelUID(thing.getUID(), channelId);
ChannelTypeUID channelTypeUID = createChannelTypeUID(channelId);
Channel channel = callback.createChannelBuilder(channelUID, channelTypeUID).build();
final ChannelUID channelUID = new ChannelUID(thing.getUID(), channelId);
final ChannelTypeUID channelTypeUID = createChannelTypeUID(channelId);
final Channel channel = callback.createChannelBuilder(channelUID, channelTypeUID).build();
updateThing(editThing().withoutChannel(channelUID).withChannel(channel).build());
}
}

View File

@ -187,6 +187,28 @@ public class Powerline546EHandler extends AVMFritzBaseBridgeHandler implements F
}
}
/**
* Creates a {@link ChannelTypeUID} from the given channel id.
*
* @param channelId ID of the channel type UID to be created.
* @return the channel type UID
*/
private ChannelTypeUID createChannelTypeUID(String channelId) {
final ChannelTypeUID channelTypeUID;
switch (channelId) {
case CHANNEL_BATTERY:
channelTypeUID = DefaultSystemChannelTypeProvider.SYSTEM_CHANNEL_BATTERY_LEVEL.getUID();
break;
case CHANNEL_VOLTAGE:
channelTypeUID = DefaultSystemChannelTypeProvider.SYSTEM_ELECTRIC_VOLTAGE.getUID();
break;
default:
channelTypeUID = new ChannelTypeUID(BINDING_ID, channelId);
break;
}
return channelTypeUID;
}
/**
* Creates new channels for the thing.
*
@ -195,11 +217,9 @@ public class Powerline546EHandler extends AVMFritzBaseBridgeHandler implements F
private void createChannel(String channelId) {
ThingHandlerCallback callback = getCallback();
if (callback != null) {
ChannelUID channelUID = new ChannelUID(thing.getUID(), channelId);
ChannelTypeUID channelTypeUID = CHANNEL_BATTERY.equals(channelId)
? DefaultSystemChannelTypeProvider.SYSTEM_CHANNEL_BATTERY_LEVEL.getUID()
: new ChannelTypeUID(BINDING_ID, channelId);
Channel channel = callback.createChannelBuilder(channelUID, channelTypeUID).build();
final ChannelUID channelUID = new ChannelUID(thing.getUID(), channelId);
final ChannelTypeUID channelTypeUID = createChannelTypeUID(channelId);
final Channel channel = callback.createChannelBuilder(channelUID, channelTypeUID).build();
updateThing(editThing().withoutChannel(channelUID).withChannel(channel).build());
}
}

View File

@ -45,7 +45,7 @@
<label>Password</label>
<description>Password to access the FRITZ!Box.</description>
</parameter>
<parameter name="pollingInterval" type="integer" min="5" max="60" unit="s" groupName="connection">
<parameter name="pollingInterval" type="integer" min="1" max="60" unit="s" groupName="connection">
<label>Polling Interval</label>
<description>Interval polling the FRITZ!Box (in seconds).</description>
<default>15</default>
@ -104,7 +104,7 @@
<label>Password</label>
<description>Password to access the FRITZ!Powerline.</description>
</parameter>
<parameter name="pollingInterval" type="integer" min="5" max="60" unit="s" groupName="connection">
<parameter name="pollingInterval" type="integer" min="1" max="60" unit="s" groupName="connection">
<label>Polling Interval</label>
<description>Interval polling the FRITZ!Powerline (in seconds).</description>
<default>15</default>

View File

@ -7,16 +7,32 @@ addon.avmfritz.description = This is the binding for AVM FRITZ! devices.
thing-type.avmfritz.Comet_DECT.label = Comet DECT
thing-type.avmfritz.Comet_DECT.description = Comet DECT heating thermostat.
thing-type.avmfritz.Comet_DECT.channel.actual_temp.label = Current Temperature
thing-type.avmfritz.Comet_DECT.channel.actual_temp.description = Current measured temperature.
thing-type.avmfritz.FRITZ_DECT_200.label = FRITZ!DECT 200
thing-type.avmfritz.FRITZ_DECT_200.description = FRITZ!DECT200 switchable outlet.
thing-type.avmfritz.FRITZ_DECT_200.channel.energy.label = Energy Consumption
thing-type.avmfritz.FRITZ_DECT_200.channel.energy.description = Accumulated energy consumption.
thing-type.avmfritz.FRITZ_DECT_200.channel.power.label = Power
thing-type.avmfritz.FRITZ_DECT_200.channel.power.description = Current power consumption.
thing-type.avmfritz.FRITZ_DECT_210.label = FRITZ!DECT 210
thing-type.avmfritz.FRITZ_DECT_210.description = FRITZ!DECT210 switchable outlet.
thing-type.avmfritz.FRITZ_DECT_210.channel.energy.label = Energy Consumption
thing-type.avmfritz.FRITZ_DECT_210.channel.energy.description = Accumulated energy consumption.
thing-type.avmfritz.FRITZ_DECT_210.channel.power.label = Power
thing-type.avmfritz.FRITZ_DECT_210.channel.power.description = Current power consumption.
thing-type.avmfritz.FRITZ_DECT_300.label = FRITZ!DECT 300
thing-type.avmfritz.FRITZ_DECT_300.description = FRITZ!DECT 300 heating thermostat.
thing-type.avmfritz.FRITZ_DECT_300.channel.actual_temp.label = Current Temperature
thing-type.avmfritz.FRITZ_DECT_300.channel.actual_temp.description = Current measured temperature.
thing-type.avmfritz.FRITZ_DECT_301.label = FRITZ!DECT 301
thing-type.avmfritz.FRITZ_DECT_301.description = FRITZ!DECT 301 heating thermostat.
thing-type.avmfritz.FRITZ_DECT_301.channel.actual_temp.label = Current Temperature
thing-type.avmfritz.FRITZ_DECT_301.channel.actual_temp.description = Current measured temperature.
thing-type.avmfritz.FRITZ_DECT_302.label = FRITZ!DECT 302
thing-type.avmfritz.FRITZ_DECT_302.description = FRITZ!DECT 302 heating thermostat.
thing-type.avmfritz.FRITZ_DECT_302.channel.actual_temp.label = Current Temperature
thing-type.avmfritz.FRITZ_DECT_302.channel.actual_temp.description = Current measured temperature.
thing-type.avmfritz.FRITZ_DECT_400.label = FRITZ!DECT 400
thing-type.avmfritz.FRITZ_DECT_400.description = FRITZ!DECT400 switch.
thing-type.avmfritz.FRITZ_DECT_400.channel.press.label = Button Press
@ -33,12 +49,26 @@ thing-type.avmfritz.FRITZ_DECT_Repeater_100.label = FRITZ!DECT Repeater 100
thing-type.avmfritz.FRITZ_DECT_Repeater_100.description = FRITZ!DECT Repeater 100 DECT repeater.
thing-type.avmfritz.FRITZ_GROUP_HEATING.label = Heating Group
thing-type.avmfritz.FRITZ_GROUP_HEATING.description = Group for heating thermostats.
thing-type.avmfritz.FRITZ_GROUP_HEATING.channel.actual_temp.label = Current Temperature
thing-type.avmfritz.FRITZ_GROUP_HEATING.channel.actual_temp.description = Current measured temperature.
thing-type.avmfritz.FRITZ_GROUP_SWITCH.label = Switch Group
thing-type.avmfritz.FRITZ_GROUP_SWITCH.description = Group for switchable outlets and power meters.
thing-type.avmfritz.FRITZ_GROUP_SWITCH.channel.energy.label = Energy Consumption
thing-type.avmfritz.FRITZ_GROUP_SWITCH.channel.energy.description = Accumulated energy consumption.
thing-type.avmfritz.FRITZ_GROUP_SWITCH.channel.power.label = Power
thing-type.avmfritz.FRITZ_GROUP_SWITCH.channel.power.description = Current power consumption.
thing-type.avmfritz.FRITZ_Powerline_546E.label = FRITZ!Powerline 546E
thing-type.avmfritz.FRITZ_Powerline_546E.description = FRITZ!Powerline 546E with switchable outlet.
thing-type.avmfritz.FRITZ_Powerline_546E.channel.energy.label = Energy Consumption
thing-type.avmfritz.FRITZ_Powerline_546E.channel.energy.description = Accumulated energy consumption.
thing-type.avmfritz.FRITZ_Powerline_546E.channel.power.label = Power
thing-type.avmfritz.FRITZ_Powerline_546E.channel.power.description = Current power consumption.
thing-type.avmfritz.FRITZ_Powerline_546E_Solo.label = FRITZ!Powerline 546E
thing-type.avmfritz.FRITZ_Powerline_546E_Solo.description = A FRITZ!Powerline 546E with switchable outlet in stand-alone mode.
thing-type.avmfritz.FRITZ_Powerline_546E_Solo.channel.energy.label = Energy Consumption
thing-type.avmfritz.FRITZ_Powerline_546E_Solo.channel.energy.description = Accumulated energy consumption.
thing-type.avmfritz.FRITZ_Powerline_546E_Solo.channel.power.label = Power
thing-type.avmfritz.FRITZ_Powerline_546E_Solo.channel.power.description = Current power consumption.
thing-type.avmfritz.HAN_FUN_BLINDS.label = HAN-FUN Blinds
thing-type.avmfritz.HAN_FUN_BLINDS.description = HAN-FUN blinds (e.g. RolloTron DECT 1213)
thing-type.avmfritz.HAN_FUN_COLOR_BULB.label = HAN-FUN Color Light
@ -123,8 +153,6 @@ channel-group-type.avmfritz.sensors.label = Sensor Data
channel-type.avmfritz.active_call.label = Active Call
channel-type.avmfritz.active_call.description = Details about active call.
channel-type.avmfritz.actual_temp.label = Current Temperature
channel-type.avmfritz.actual_temp.description = Current measured temperature.
channel-type.avmfritz.apply_template.label = Apply Template
channel-type.avmfritz.apply_template.description = Apply template for device(s).
channel-type.avmfritz.call_state.label = Call State
@ -137,16 +165,10 @@ channel-type.avmfritz.comfort_temp.label = Comfort Temperature
channel-type.avmfritz.comfort_temp.description = Thermostat Comfort temperature.
channel-type.avmfritz.contact_state.label = Contact State
channel-type.avmfritz.contact_state.description = Contact state information (OPEN/CLOSED).
channel-type.avmfritz.obstruction_alarm.label = Obstruction Alarm
channel-type.avmfritz.obstruction_alarm.description = Obstruction alarm of the blinds. The blinds were stopped and moved a bit in the opposite direction.
channel-type.avmfritz.temperature_alarm.label = Temperature Alarm
channel-type.avmfritz.temperature_alarm.description = Temperature alarm of the blinds. Indicates overheating of the motor.
channel-type.avmfritz.device_locked.label = Locked (manual)
channel-type.avmfritz.device_locked.description = Device is locked for switching by pressing the button on the device.
channel-type.avmfritz.eco_temp.label = Eco Temperature
channel-type.avmfritz.eco_temp.description = Thermostat Eco temperature.
channel-type.avmfritz.energy.label = Energy Consumption
channel-type.avmfritz.energy.description = Accumulated energy consumption.
channel-type.avmfritz.humidity.label = Current Humidity
channel-type.avmfritz.humidity.description = Current measured humidity.
channel-type.avmfritz.incoming_call.label = Incoming Call
@ -166,12 +188,12 @@ channel-type.avmfritz.next_change.description = Next change of Setpoint Temperat
channel-type.avmfritz.next_change.state.pattern = %1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS
channel-type.avmfritz.next_temp.label = Next Setpoint Temperature
channel-type.avmfritz.next_temp.description = Next Setpoint Temperature.
channel-type.avmfritz.obstruction_alarm.label = Obstruction Alarm
channel-type.avmfritz.obstruction_alarm.description = Obstruction alarm of the blinds. The blinds were stopped and moved a bit in the opposite direction.
channel-type.avmfritz.outgoing_call.label = Outgoing Call
channel-type.avmfritz.outgoing_call.description = Details about outgoing call.
channel-type.avmfritz.outlet.label = Outlet
channel-type.avmfritz.outlet.description = Switched outlet (ON/OFF).
channel-type.avmfritz.power.label = Power
channel-type.avmfritz.power.description = Current power consumption.
channel-type.avmfritz.radiator_mode.label = Radiator Mode
channel-type.avmfritz.radiator_mode.description = States the mode of the radiator (ON/OFF/COMFORT/ECO/BOOST/WINDOW_OPEN).
channel-type.avmfritz.radiator_mode.state.option.ON = On
@ -186,8 +208,8 @@ channel-type.avmfritz.set_temp.label = Setpoint Temperature
channel-type.avmfritz.set_temp.description = Thermostat Setpoint temperature.
channel-type.avmfritz.temperature.label = Current Temperature
channel-type.avmfritz.temperature.description = Current measured temperature.
channel-type.avmfritz.voltage.label = Voltage
channel-type.avmfritz.voltage.description = Current voltage.
channel-type.avmfritz.temperature_alarm.label = Temperature Alarm
channel-type.avmfritz.temperature_alarm.description = Temperature alarm of the blinds. Indicates overheating of the motor.
# channel types config

View File

@ -31,11 +31,21 @@
<channel id="locked" typeId="locked"/>
<channel id="device_locked" typeId="device_locked"/>
<channel id="apply_template" typeId="apply_template"/>
<channel id="energy" typeId="energy"/>
<channel id="power" typeId="power"/>
<channel id="energy" typeId="system.electrical-energy">
<label>Energy Consumption</label>
<description>Accumulated energy consumption.</description>
</channel>
<channel id="power" typeId="system.electric-power">
<label>Power</label>
<description>Current power consumption.</description>
</channel>
<channel id="outlet" typeId="outlet"/>
</channels>
<properties>
<property name="thingTypeVersion">1</property>
</properties>
<representation-property>ipAddress</representation-property>
<config-description-ref uri="bridge-type:avmfritz:fritzpowerline"/>

View File

@ -11,18 +11,21 @@
<description>Details about incoming call.</description>
<state pattern="%1$s to %2$s" readOnly="true"/>
</channel-type>
<channel-type id="outgoing_call">
<item-type>Call</item-type>
<label>Outgoing Call</label>
<description>Details about outgoing call.</description>
<state pattern="%1$s to %2$s" readOnly="true"/>
</channel-type>
<channel-type id="active_call">
<item-type>Call</item-type>
<label>Active Call</label>
<description>Details about active call.</description>
<state pattern="%1$s" readOnly="true"/>
</channel-type>
<channel-type id="call_state">
<item-type>String</item-type>
<label>Call State</label>
@ -36,6 +39,7 @@
</options>
</state>
</channel-type>
<channel-type id="apply_template" advanced="true">
<item-type>String</item-type>
<label>Apply Template</label>
@ -48,6 +52,7 @@
<item-type>String</item-type>
<label>Mode</label>
<description>States the mode of the device (MANUAL/AUTOMATIC/VACATION).</description>
<category>Heating</category>
<state pattern="%s" readOnly="true">
<options>
<option value="MANUAL">Manual</option>
@ -107,6 +112,10 @@
<label>Current Temperature</label>
<description>Current measured temperature.</description>
<category>Temperature</category>
<tags>
<tag>Measurement</tag>
<tag>Temperature</tag>
</tags>
<state pattern="%.1f %unit%" readOnly="true"/>
<config-description-ref uri="channel-type:avmfritz:temperature"/>
@ -117,46 +126,22 @@
<label>Current Humidity</label>
<description>Current measured humidity.</description>
<category>Humidity</category>
<tags>
<tag>Measurement</tag>
<tag>Humidity</tag>
</tags>
<state pattern="%.0f %unit%" readOnly="true"/>
</channel-type>
<channel-type id="energy">
<item-type>Number:Energy</item-type>
<label>Energy Consumption</label>
<description>Accumulated energy consumption.</description>
<category>Energy</category>
<state pattern="%.3f kWh" readOnly="true"/>
</channel-type>
<channel-type id="power">
<item-type>Number:Power</item-type>
<label>Power</label>
<description>Current power consumption.</description>
<category>Energy</category>
<state pattern="%.2f %unit%" readOnly="true"/>
</channel-type>
<channel-type id="voltage">
<item-type>Number:ElectricPotential</item-type>
<label>Voltage</label>
<description>Current voltage.</description>
<category>Energy</category>
<state pattern="%.1f %unit%" readOnly="true"/>
</channel-type>
<channel-type id="outlet">
<item-type>Switch</item-type>
<label>Outlet</label>
<description>Switched outlet (ON/OFF).</description>
<category>PowerOutlet</category>
</channel-type>
<channel-type id="actual_temp" advanced="true">
<item-type>Number:Temperature</item-type>
<label>Current Temperature</label>
<description>Current measured temperature.</description>
<category>Temperature</category>
<state pattern="%.1f %unit%" readOnly="true"/>
<tags>
<tag>Switch</tag>
<tag>Power</tag>
</tags>
</channel-type>
<channel-type id="set_temp">
@ -164,6 +149,10 @@
<label>Setpoint Temperature</label>
<description>Thermostat Setpoint temperature.</description>
<category>Heating</category>
<tags>
<tag>Setpoint</tag>
<tag>Temperature</tag>
</tags>
<state pattern="%.1f %unit%"/>
</channel-type>

View File

@ -91,7 +91,10 @@
<channel id="locked" typeId="locked"/>
<channel id="device_locked" typeId="device_locked"/>
<channel id="temperature" typeId="temperature"/>
<channel id="actual_temp" typeId="actual_temp"/>
<channel id="actual_temp" typeId="system.indoor-temperature">
<label>Current Temperature</label>
<description>Current measured temperature.</description>
</channel>
<channel id="set_temp" typeId="set_temp"/>
<channel id="eco_temp" typeId="eco_temp"/>
<channel id="comfort_temp" typeId="comfort_temp"/>
@ -101,6 +104,10 @@
<channel id="battery_low" typeId="system.low-battery"/>
</channels>
<properties>
<property name="thingTypeVersion">1</property>
</properties>
<representation-property>ain</representation-property>
<config-description-ref uri="thing-type:avmfritz:fritzdevice"/>
@ -120,7 +127,10 @@
<channel id="locked" typeId="locked"/>
<channel id="device_locked" typeId="device_locked"/>
<channel id="temperature" typeId="temperature"/>
<channel id="actual_temp" typeId="actual_temp"/>
<channel id="actual_temp" typeId="system.indoor-temperature">
<label>Current Temperature</label>
<description>Current measured temperature.</description>
</channel>
<channel id="set_temp" typeId="set_temp"/>
<channel id="eco_temp" typeId="eco_temp"/>
<channel id="comfort_temp" typeId="comfort_temp"/>
@ -130,6 +140,10 @@
<channel id="battery_low" typeId="system.low-battery"/>
</channels>
<properties>
<property name="thingTypeVersion">1</property>
</properties>
<representation-property>ain</representation-property>
<config-description-ref uri="thing-type:avmfritz:fritzdevice"/>
@ -149,7 +163,10 @@
<channel id="locked" typeId="locked"/>
<channel id="device_locked" typeId="device_locked"/>
<channel id="temperature" typeId="temperature"/>
<channel id="actual_temp" typeId="actual_temp"/>
<channel id="actual_temp" typeId="system.indoor-temperature">
<label>Current Temperature</label>
<description>Current measured temperature.</description>
</channel>
<channel id="set_temp" typeId="set_temp"/>
<channel id="eco_temp" typeId="eco_temp"/>
<channel id="comfort_temp" typeId="comfort_temp"/>
@ -159,6 +176,10 @@
<channel id="battery_low" typeId="system.low-battery"/>
</channels>
<properties>
<property name="thingTypeVersion">1</property>
</properties>
<representation-property>ain</representation-property>
<config-description-ref uri="thing-type:avmfritz:fritzdevice"/>
@ -178,7 +199,10 @@
<channel id="locked" typeId="locked"/>
<channel id="device_locked" typeId="device_locked"/>
<channel id="temperature" typeId="temperature"/>
<channel id="actual_temp" typeId="actual_temp"/>
<channel id="actual_temp" typeId="system.indoor-temperature">
<label>Current Temperature</label>
<description>Current measured temperature.</description>
</channel>
<channel id="set_temp" typeId="set_temp"/>
<channel id="eco_temp" typeId="eco_temp"/>
<channel id="comfort_temp" typeId="comfort_temp"/>
@ -188,6 +212,10 @@
<channel id="battery_low" typeId="system.low-battery"/>
</channels>
<properties>
<property name="thingTypeVersion">1</property>
</properties>
<representation-property>ain</representation-property>
<config-description-ref uri="thing-type:avmfritz:fritzdevice"/>
@ -207,11 +235,21 @@
<channel id="locked" typeId="locked"/>
<channel id="device_locked" typeId="device_locked"/>
<channel id="temperature" typeId="temperature"/>
<channel id="energy" typeId="energy"/>
<channel id="power" typeId="power"/>
<channel id="energy" typeId="system.electrical-energy">
<label>Energy Consumption</label>
<description>Accumulated energy consumption.</description>
</channel>
<channel id="power" typeId="system.electric-power">
<label>Power</label>
<description>Current power consumption.</description>
</channel>
<channel id="outlet" typeId="outlet"/>
</channels>
<properties>
<property name="thingTypeVersion">1</property>
</properties>
<representation-property>ain</representation-property>
<config-description-ref uri="thing-type:avmfritz:fritzdevice"/>
@ -231,11 +269,21 @@
<channel id="locked" typeId="locked"/>
<channel id="device_locked" typeId="device_locked"/>
<channel id="temperature" typeId="temperature"/>
<channel id="energy" typeId="energy"/>
<channel id="power" typeId="power"/>
<channel id="energy" typeId="system.electrical-energy">
<label>Energy Consumption</label>
<description>Accumulated energy consumption.</description>
</channel>
<channel id="power" typeId="system.electric-power">
<label>Power</label>
<description>Current power consumption.</description>
</channel>
<channel id="outlet" typeId="outlet"/>
</channels>
<properties>
<property name="thingTypeVersion">1</property>
</properties>
<representation-property>ain</representation-property>
<config-description-ref uri="thing-type:avmfritz:fritzdevice"/>
@ -255,11 +303,21 @@
<channel id="mode" typeId="mode"/>
<channel id="locked" typeId="locked"/>
<channel id="device_locked" typeId="device_locked"/>
<channel id="energy" typeId="energy"/>
<channel id="power" typeId="power"/>
<channel id="energy" typeId="system.electrical-energy">
<label>Energy Consumption</label>
<description>Accumulated energy consumption.</description>
</channel>
<channel id="power" typeId="system.electric-power">
<label>Power</label>
<description>Current power consumption.</description>
</channel>
<channel id="outlet" typeId="outlet"/>
</channels>
<properties>
<property name="thingTypeVersion">1</property>
</properties>
<representation-property>ain</representation-property>
<config-description-ref uri="thing-type:avmfritz:fritzdevice"/>
@ -410,7 +468,10 @@
<channel id="mode" typeId="mode"/>
<channel id="locked" typeId="locked"/>
<channel id="device_locked" typeId="device_locked"/>
<channel id="actual_temp" typeId="actual_temp"/>
<channel id="actual_temp" typeId="system.indoor-temperature">
<label>Current Temperature</label>
<description>Current measured temperature.</description>
</channel>
<channel id="set_temp" typeId="set_temp"/>
<channel id="eco_temp" typeId="eco_temp"/>
<channel id="comfort_temp" typeId="comfort_temp"/>
@ -420,6 +481,10 @@
<channel id="battery_low" typeId="system.low-battery"/>
</channels>
<properties>
<property name="thingTypeVersion">1</property>
</properties>
<representation-property>ain</representation-property>
<config-description-ref uri="thing-type:avmfritz:fritzgroup"/>
@ -438,11 +503,21 @@
<channel id="mode" typeId="mode"/>
<channel id="locked" typeId="locked"/>
<channel id="device_locked" typeId="device_locked"/>
<channel id="energy" typeId="energy"/>
<channel id="power" typeId="power"/>
<channel id="energy" typeId="system.electrical-energy">
<label>Energy Consumption</label>
<description>Accumulated energy consumption.</description>
</channel>
<channel id="power" typeId="system.electric-power">
<label>Power</label>
<description>Current power consumption.</description>
</channel>
<channel id="outlet" typeId="outlet"/>
</channels>
<properties>
<property name="thingTypeVersion">1</property>
</properties>
<representation-property>ain</representation-property>
<config-description-ref uri="thing-type:avmfritz:fritzgroup"/>

View File

@ -0,0 +1,116 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<update:update-descriptions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:update="https://openhab.org/schemas/update-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/update-description/v1.0.0 https://openhab.org/schemas/update-description-1.0.0.xsd">
<thing-type uid="avmfritz:FRITZ_Powerline_546E_Solo">
<instruction-set targetVersion="1">
<update-channel id="energy">
<type>system:electrical-energy</type>
</update-channel>
<update-channel id="power">
<type>system:electrical-power</type>
</update-channel>
<update-channel id="voltage">
<type>system:electrical-voltage</type>
</update-channel>
</instruction-set>
</thing-type>
<thing-type uid="avmfritz:FRITZ_DECT_210">
<instruction-set targetVersion="1">
<update-channel id="energy">
<type>system:electrical-energy</type>
</update-channel>
<update-channel id="power">
<type>system:electrical-power</type>
</update-channel>
<update-channel id="voltage">
<type>system:electrical-voltage</type>
</update-channel>
</instruction-set>
</thing-type>
<thing-type uid="avmfritz:FRITZ_DECT_200">
<instruction-set targetVersion="1">
<update-channel id="energy">
<type>system:electrical-energy</type>
</update-channel>
<update-channel id="power">
<type>system:electrical-power</type>
</update-channel>
<update-channel id="voltage">
<type>system:electrical-voltage</type>
</update-channel>
</instruction-set>
</thing-type>
<thing-type uid="avmfritz:FRITZ_Powerline_546E">
<instruction-set targetVersion="1">
<update-channel id="energy">
<type>system:electrical-energy</type>
</update-channel>
<update-channel id="power">
<type>system:electrical-power</type>
</update-channel>
<update-channel id="voltage">
<type>system:electrical-voltage</type>
</update-channel>
</instruction-set>
</thing-type>
<thing-type uid="avmfritz:Comet_DECT">
<instruction-set targetVersion="1">
<update-channel id="actual_temp">
<type>system:indoor-temperature</type>
</update-channel>
</instruction-set>
</thing-type>
<thing-type uid="avmfritz:FRITZ_DECT_302">
<instruction-set targetVersion="1">
<update-channel id="actual_temp">
<type>system:indoor-temperature</type>
</update-channel>
</instruction-set>
</thing-type>
<thing-type uid="avmfritz:FRITZ_DECT_301">
<instruction-set targetVersion="1">
<update-channel id="actual_temp">
<type>system:indoor-temperature</type>
</update-channel>
</instruction-set>
</thing-type>
<thing-type uid="avmfritz:FRITZ_DECT_300">
<instruction-set targetVersion="1">
<update-channel id="actual_temp">
<type>system:indoor-temperature</type>
</update-channel>
</instruction-set>
</thing-type>
<thing-type uid="avmfritz:FRITZ_GROUP_HEATING">
<instruction-set targetVersion="1">
<update-channel id="actual_temp">
<type>system:indoor-temperature</type>
</update-channel>
</instruction-set>
</thing-type>
<thing-type uid="avmfritz:FRITZ_GROUP_SWITCH">
<instruction-set targetVersion="1">
<update-channel id="energy">
<type>system:electrical-energy</type>
</update-channel>
<update-channel id="power">
<type>system:electrical-power</type>
</update-channel>
<update-channel id="voltage">
<type>system:electrical-voltage</type>
</update-channel>
</instruction-set>
</thing-type>
</update:update-descriptions>

View File

@ -14,6 +14,8 @@ package org.openhab.binding.avmfritz.internal.actions;
import static org.junit.jupiter.api.Assertions.assertThrows;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
@ -29,6 +31,7 @@ import org.openhab.core.thing.binding.ThingHandler;
* @author Christoph Weitkamp - Initial contribution
*/
@ExtendWith(MockitoExtension.class)
@NonNullByDefault
public class AVMFritzHeatingActionsTest {
private final ThingActions thingActionsStub = new ThingActions() {
@ -37,14 +40,14 @@ public class AVMFritzHeatingActionsTest {
}
@Override
public ThingHandler getThingHandler() {
public @Nullable ThingHandler getThingHandler() {
return null;
}
};
private @Mock AVMFritzHeatingActionsHandler heatingActionsHandler;
private @Mock @NonNullByDefault({}) AVMFritzHeatingActionsHandler heatingActionsHandlerMock;
private AVMFritzHeatingActions heatingActions;
private @NonNullByDefault({}) AVMFritzHeatingActions heatingActions;
@BeforeEach
public void setUp() {
@ -65,13 +68,13 @@ public class AVMFritzHeatingActionsTest {
@Test
public void testSetBoostModeDurationNull() {
heatingActions.setThingHandler(heatingActionsHandler);
heatingActions.setThingHandler(heatingActionsHandlerMock);
assertThrows(IllegalArgumentException.class, () -> AVMFritzHeatingActions.setBoostMode(heatingActions, null));
}
@Test
public void testSetBoostMode() {
heatingActions.setThingHandler(heatingActionsHandler);
heatingActions.setThingHandler(heatingActionsHandlerMock);
AVMFritzHeatingActions.setBoostMode(heatingActions, Long.valueOf(5L));
}
@ -89,14 +92,14 @@ public class AVMFritzHeatingActionsTest {
@Test
public void testSetWindowOpenModeDurationNull() {
heatingActions.setThingHandler(heatingActionsHandler);
heatingActions.setThingHandler(heatingActionsHandlerMock);
assertThrows(IllegalArgumentException.class,
() -> AVMFritzHeatingActions.setWindowOpenMode(heatingActions, null));
}
@Test
public void testSetWindowOpenMode() {
heatingActions.setThingHandler(heatingActionsHandler);
heatingActions.setThingHandler(heatingActionsHandlerMock);
AVMFritzHeatingActions.setWindowOpenMode(heatingActions, Long.valueOf(5L));
}
}