]> git.basschouten.com Git - openhab-addons.git/commitdiff
[avmfritz] Use system channel types and decrease minimum polling interval (#14587)
authorChristoph Weitkamp <github@christophweitkamp.de>
Thu, 23 Mar 2023 21:55:01 +0000 (22:55 +0100)
committerGitHub <noreply@github.com>
Thu, 23 Mar 2023 21:55:01 +0000 (22:55 +0100)
* Use system default channel types
* Changed minimum polling interval to 1s

Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
bundles/org.openhab.binding.avmfritz/README.md
bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/handler/AVMFritzBaseBridgeHandler.java
bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/handler/AVMFritzBaseThingHandler.java
bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/handler/Powerline546EHandler.java
bundles/org.openhab.binding.avmfritz/src/main/resources/OH-INF/config/config.xml
bundles/org.openhab.binding.avmfritz/src/main/resources/OH-INF/i18n/avmfritz.properties
bundles/org.openhab.binding.avmfritz/src/main/resources/OH-INF/thing/bridge-types.xml
bundles/org.openhab.binding.avmfritz/src/main/resources/OH-INF/thing/channel-types.xml
bundles/org.openhab.binding.avmfritz/src/main/resources/OH-INF/thing/thing-types.xml
bundles/org.openhab.binding.avmfritz/src/main/resources/OH-INF/update/instructions.xml [new file with mode: 0644]
bundles/org.openhab.binding.avmfritz/src/test/java/org/openhab/binding/avmfritz/internal/actions/AVMFritzHeatingActionsTest.java

index e16cb272e6898d39fb4b0899ddf13f7cfd0673cf..13191f37a491b7dee7ca5e220acf8b5fc2a5f743 100644 (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)
 
index b1950aca19cacb1a7ea481644953509880911b87..82e27925a2b39e23406422634afa0887d605085c 100644 (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);
         }
     }
 
index b553a714b3a52efd7c24d79b58ca242ff47079f3..c8b9c783051aa2e0d205abe428c34e427e8f8c81 100644 (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());
         }
     }
index 5b2ca39896ebc49c16d6550673b3b04bf9360b86..01106f3c53608b6771f8611e6482960c05b0201c 100644 (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());
         }
     }
index 9cad0c865b690a071f2eda5182595dbe5956aba0..156481e2fed0fe158cf1590b8d285436d5c31fdf 100644 (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>
                        <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>
index e019b08736021083d02a79486eee322ae85f14ab..aec742bf3a51a0cfb2ad0f167a222d0af2409d2f 100644 (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
 
index a3aa4405332bcf4b5b4ecde0a3b8726fc34c160a..c019b633eb1fcc80bcdb144b898e7de4d73fa741 100644 (file)
                        <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"/>
index 69543c6c8d73518f117cf194928613d6b45b5b7a..d16c8e528252affad3b62c87a9df1cafedcdea1d 100644 (file)
                <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>
                <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"/>
                <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">
                <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>
 
index 00c37e4350d45b3a02b0e5414b9f3652a7ed0a34..26d8691bed5d943d843a2ff958334c7ef80ff69b 100644 (file)
                        <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"/>
                        <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"/>
                        <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"/>
                        <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"/>
                        <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"/>
                        <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"/>
                        <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"/>
                        <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"/>
                        <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"/>
                        <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"/>
                        <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"/>
                        <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"/>
                        <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"/>
                        <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"/>
diff --git a/bundles/org.openhab.binding.avmfritz/src/main/resources/OH-INF/update/instructions.xml b/bundles/org.openhab.binding.avmfritz/src/main/resources/OH-INF/update/instructions.xml
new file mode 100644 (file)
index 0000000..21263d9
--- /dev/null
@@ -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>
index e00ded159d82a6faed0124a3ad5e078397dd506c..815c3b644de39960c432bf31af0a7ea37090c391 100644 (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));
     }
 }