]> git.basschouten.com Git - openhab-addons.git/commitdiff
[freeboxos] Fix phone and calls configuration (#17272)
authorlolodomo <lg.hc@free.fr>
Sat, 17 Aug 2024 18:03:03 +0000 (20:03 +0200)
committerGitHub <noreply@github.com>
Sat, 17 Aug 2024 18:03:03 +0000 (20:03 +0200)
Fix #17262

Also remove the unused class LanlineConfiguration

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/config/LandlineConfiguration.java [deleted file]
bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/config/PhoneConfigurationBuilder.java
bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/discovery/FreeboxOsDiscoveryService.java
bundles/org.openhab.binding.freeboxos/src/main/resources/OH-INF/config/phone-config.xml
bundles/org.openhab.binding.freeboxos/src/main/resources/OH-INF/i18n/freeboxos.properties
bundles/org.openhab.binding.freeboxos/src/main/resources/OH-INF/thing/phone-thing-type.xml

diff --git a/bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/config/LandlineConfiguration.java b/bundles/org.openhab.binding.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/config/LandlineConfiguration.java
deleted file mode 100644 (file)
index 0fed6b0..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * Copyright (c) 2010-2024 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.freeboxos.internal.config;
-
-import org.eclipse.jdt.annotation.NonNullByDefault;
-
-/**
- * The {@link LandlineConfiguration} is responsible for holding
- * configuration informations associated to a Freebox Phone thing type
- *
- * @author GaĆ«l L'hopital - Initial contribution
- */
-@NonNullByDefault
-public class LandlineConfiguration extends ApiConsumerConfiguration {
-    public int id = 1;
-
-    LandlineConfiguration() {
-        refreshInterval = 2;
-    }
-}
index f46fe12cdf6f90bda9fb6e93817c16fe233e9b5b..a474b4c59a37a4898f32b836ab5cb3aa91f91cf9 100644 (file)
@@ -42,13 +42,20 @@ public class PhoneConfigurationBuilder {
     }
 
     public DiscoveryResultBuilder configure(ThingUID bridgeUID, Status config) {
-        ThingUID thingUID = new ThingUID(Type.DECT.equals(config.type()) ? THING_TYPE_DECT : THING_TYPE_FXS, bridgeUID,
-                Integer.toString(config.id()));
+        ThingUID thingUID;
+        String label;
+        if (Type.DECT.equals(config.type())) {
+            thingUID = new ThingUID(THING_TYPE_DECT, bridgeUID, Integer.toString(config.id()));
+            label = "DECT Phone";
+        } else {
+            thingUID = new ThingUID(THING_TYPE_FXS, bridgeUID, Integer.toString(config.id()));
+            label = "Landline Phone";
+        }
 
         logger.debug("Adding new Freebox Phone {} to inbox", thingUID);
 
         return DiscoveryResultBuilder.create(thingUID).withBridge(bridgeUID)
-                .withProperty(ClientConfiguration.ID, config.id()).withLabel(config.type().name())
+                .withProperty(ClientConfiguration.ID, config.id()).withLabel(label)
                 .withRepresentationProperty(ClientConfiguration.ID);
     }
 }
index b9628dade0aa3c82f72c1a5488f83d1eb7a1a765..aa40187ff1661bfde04d86bb5b35a5a7147a352d 100644 (file)
@@ -159,10 +159,10 @@ public class FreeboxOsDiscoveryService extends AbstractThingHandlerDiscoveryServ
             logger.debug("Error discovering phones: {}", e.getMessage());
         }
         if (!statuses.isEmpty()) {
-            ThingUID thingUID = new ThingUID(THING_TYPE_CALL, bridgeUID, "landline");
+            ThingUID thingUID = new ThingUID(THING_TYPE_CALL, bridgeUID, "calls");
             logger.debug("Adding new Call thing {} to inbox", thingUID);
             DiscoveryResult discoveryResult = DiscoveryResultBuilder.create(thingUID).withBridge(bridgeUID)
-                    .withLabel("Freebox Calls").build();
+                    .withLabel("Phone Calls").build();
             thingDiscovered(discoveryResult);
         }
     }
index 430d95bb06b77178aa856ea39142cc55f3df3c87..c2f4aff371ec6b743a556e8e199295dbdae2dafa 100644 (file)
@@ -7,7 +7,7 @@
 
        <config-description uri="thing-type:freeboxos:phone">
                <parameter name="refreshInterval" type="integer" min="1" unit="s">
-                       <label>State Refresh Interval</label>
+                       <label>Refresh Interval</label>
                        <description>The refresh interval in seconds which is used to poll for phone state.</description>
                        <default>30</default>
                </parameter>
@@ -20,9 +20,9 @@
 
        <config-description uri="thing-type:freeboxos:call">
                <parameter name="refreshInterval" type="integer" min="1" unit="s">
-                       <label>State Refresh Interval</label>
-                       <description>The refresh interval in seconds which is used to poll for phone state.</description>
-                       <default>2</default>
+                       <label>Refresh Interval</label>
+                       <description>The refresh interval in seconds which is used to poll for phone calls.</description>
+                       <default>30</default>
                </parameter>
        </config-description>
 
index 33a32df880770e3557433acecc5bf9832f427eb5..fbe6c125853a385e036a1f75234ecc77aa05cdc9 100644 (file)
@@ -25,9 +25,9 @@ thing-type.freeboxos.api.label = Freebox OS Api
 thing-type.freeboxos.api.description = Bridge between hosts and the API rest service
 thing-type.freeboxos.basic-shutter.label = Freebox Home Basic Shutter
 thing-type.freeboxos.basic-shutter.description = The Basic Shutter (UP,DOWN,STOP) configured in your Freebox Delta Server
-thing-type.freeboxos.call.label = Calls
+thing-type.freeboxos.call.label = Phone Calls
 thing-type.freeboxos.call.description = Provides various informations regarding the phone calls
-thing-type.freeboxos.dect.label = DECT
+thing-type.freeboxos.dect.label = DECT Phone
 thing-type.freeboxos.dect.description = Provides various informations regarding the DECT state and configuration
 thing-type.freeboxos.dect.channel.gain-rx.label = Gain RX
 thing-type.freeboxos.dect.channel.gain-tx.label = Gain TX
@@ -40,7 +40,7 @@ thing-type.freeboxos.freeplug.channel.rate-down.label = Rx Rate
 thing-type.freeboxos.freeplug.channel.rate-down.description = Current RX rate
 thing-type.freeboxos.freeplug.channel.rate-up.label = Tx Rate
 thing-type.freeboxos.freeplug.channel.rate-up.description = Current TX Rate
-thing-type.freeboxos.fxs.label = Landline
+thing-type.freeboxos.fxs.label = Landline Phone
 thing-type.freeboxos.fxs.description = Provides various informations regarding the landline state
 thing-type.freeboxos.host.label = Network Device
 thing-type.freeboxos.host.description = Provides network device reachability
@@ -75,8 +75,8 @@ bridge-type.config.freeboxos.api.httpsPort.label = HTTPS port
 bridge-type.config.freeboxos.api.httpsPort.description = Port to use for HTTPS access to the Freebox Api
 bridge-type.config.freeboxos.api.wsReconnectInterval.label = Websocket Reconnect Interval
 bridge-type.config.freeboxos.api.wsReconnectInterval.description = Disconnection interval, in minutes- 0 disables websocket usage
-thing-type.config.freeboxos.call.refreshInterval.label = State Refresh Interval
-thing-type.config.freeboxos.call.refreshInterval.description = The refresh interval in seconds which is used to poll for phone state.
+thing-type.config.freeboxos.call.refreshInterval.label = Refresh Interval
+thing-type.config.freeboxos.call.refreshInterval.description = The refresh interval in seconds which is used to poll for phone calls.
 thing-type.config.freeboxos.home-node.id.label = ID
 thing-type.config.freeboxos.home-node.id.description = Id of the Home Node
 thing-type.config.freeboxos.home-node.refreshInterval.label = Refresh Interval
@@ -87,7 +87,7 @@ thing-type.config.freeboxos.host.refreshInterval.label = Refresh Interval
 thing-type.config.freeboxos.host.refreshInterval.description = The refresh interval in seconds which is used to poll given device
 thing-type.config.freeboxos.phone.id.label = ID
 thing-type.config.freeboxos.phone.id.description = Id of the phone line
-thing-type.config.freeboxos.phone.refreshInterval.label = State Refresh Interval
+thing-type.config.freeboxos.phone.refreshInterval.label = Refresh Interval
 thing-type.config.freeboxos.phone.refreshInterval.description = The refresh interval in seconds which is used to poll for phone state.
 thing-type.config.freeboxos.player.acceptAllMp3.label = Accept All MP3
 thing-type.config.freeboxos.player.acceptAllMp3.description = Accept any bitrate for MP3 audio or only bitrates greater than 64 kbps
index 2a0e53b46da393e8ecbe018859a2649a11bbda8d..1abe34c3d114282980c6fc12f30b37fd83983086 100644 (file)
@@ -9,7 +9,7 @@
                        <bridge-type-ref id="api"/>
                </supported-bridge-type-refs>
 
-               <label>Landline</label>
+               <label>Landline Phone</label>
                <description>Provides various informations regarding the landline state</description>
 
                <channels>
@@ -29,7 +29,7 @@
                        <bridge-type-ref id="api"/>
                </supported-bridge-type-refs>
 
-               <label>DECT</label>
+               <label>DECT Phone</label>
                <description>Provides various informations regarding the DECT state and configuration</description>
 
                <channels>
@@ -56,7 +56,7 @@
                        <bridge-type-ref id="api"/>
                </supported-bridge-type-refs>
 
-               <label>Calls</label>
+               <label>Phone Calls</label>
                <description>Provides various informations regarding the phone calls</description>
 
                <channel-groups>