[freeboxos] Fix phone and calls configuration (#17272)

Fix #17262

Also remove the unused class LanlineConfiguration

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
This commit is contained in:
lolodomo 2024-08-17 20:03:03 +02:00 committed by GitHub
parent 97e9f374ad
commit 22efa534c8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 25 additions and 48 deletions

View File

@ -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;
}
}

View File

@ -42,13 +42,20 @@ public class PhoneConfigurationBuilder {
} }
public DiscoveryResultBuilder configure(ThingUID bridgeUID, Status config) { public DiscoveryResultBuilder configure(ThingUID bridgeUID, Status config) {
ThingUID thingUID = new ThingUID(Type.DECT.equals(config.type()) ? THING_TYPE_DECT : THING_TYPE_FXS, bridgeUID, ThingUID thingUID;
Integer.toString(config.id())); 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); logger.debug("Adding new Freebox Phone {} to inbox", thingUID);
return DiscoveryResultBuilder.create(thingUID).withBridge(bridgeUID) 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); .withRepresentationProperty(ClientConfiguration.ID);
} }
} }

View File

@ -159,10 +159,10 @@ public class FreeboxOsDiscoveryService extends AbstractThingHandlerDiscoveryServ
logger.debug("Error discovering phones: {}", e.getMessage()); logger.debug("Error discovering phones: {}", e.getMessage());
} }
if (!statuses.isEmpty()) { 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); logger.debug("Adding new Call thing {} to inbox", thingUID);
DiscoveryResult discoveryResult = DiscoveryResultBuilder.create(thingUID).withBridge(bridgeUID) DiscoveryResult discoveryResult = DiscoveryResultBuilder.create(thingUID).withBridge(bridgeUID)
.withLabel("Freebox Calls").build(); .withLabel("Phone Calls").build();
thingDiscovered(discoveryResult); thingDiscovered(discoveryResult);
} }
} }

View File

@ -7,7 +7,7 @@
<config-description uri="thing-type:freeboxos:phone"> <config-description uri="thing-type:freeboxos:phone">
<parameter name="refreshInterval" type="integer" min="1" unit="s"> <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> <description>The refresh interval in seconds which is used to poll for phone state.</description>
<default>30</default> <default>30</default>
</parameter> </parameter>
@ -20,9 +20,9 @@
<config-description uri="thing-type:freeboxos:call"> <config-description uri="thing-type:freeboxos:call">
<parameter name="refreshInterval" type="integer" min="1" unit="s"> <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> <description>The refresh interval in seconds which is used to poll for phone calls.</description>
<default>2</default> <default>30</default>
</parameter> </parameter>
</config-description> </config-description>

View 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.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.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.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.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.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-rx.label = Gain RX
thing-type.freeboxos.dect.channel.gain-tx.label = Gain TX 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-down.description = Current RX rate
thing-type.freeboxos.freeplug.channel.rate-up.label = Tx 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.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.fxs.description = Provides various informations regarding the landline state
thing-type.freeboxos.host.label = Network Device thing-type.freeboxos.host.label = Network Device
thing-type.freeboxos.host.description = Provides network device reachability 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.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.label = Websocket Reconnect Interval
bridge-type.config.freeboxos.api.wsReconnectInterval.description = Disconnection interval, in minutes- 0 disables websocket usage 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.label = 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.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.label = ID
thing-type.config.freeboxos.home-node.id.description = Id of the Home Node thing-type.config.freeboxos.home-node.id.description = Id of the Home Node
thing-type.config.freeboxos.home-node.refreshInterval.label = Refresh Interval 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.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.label = ID
thing-type.config.freeboxos.phone.id.description = Id of the phone line 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.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.label = Accept All MP3
thing-type.config.freeboxos.player.acceptAllMp3.description = Accept any bitrate for MP3 audio or only bitrates greater than 64 kbps thing-type.config.freeboxos.player.acceptAllMp3.description = Accept any bitrate for MP3 audio or only bitrates greater than 64 kbps

View File

@ -9,7 +9,7 @@
<bridge-type-ref id="api"/> <bridge-type-ref id="api"/>
</supported-bridge-type-refs> </supported-bridge-type-refs>
<label>Landline</label> <label>Landline Phone</label>
<description>Provides various informations regarding the landline state</description> <description>Provides various informations regarding the landline state</description>
<channels> <channels>
@ -29,7 +29,7 @@
<bridge-type-ref id="api"/> <bridge-type-ref id="api"/>
</supported-bridge-type-refs> </supported-bridge-type-refs>
<label>DECT</label> <label>DECT Phone</label>
<description>Provides various informations regarding the DECT state and configuration</description> <description>Provides various informations regarding the DECT state and configuration</description>
<channels> <channels>
@ -56,7 +56,7 @@
<bridge-type-ref id="api"/> <bridge-type-ref id="api"/>
</supported-bridge-type-refs> </supported-bridge-type-refs>
<label>Calls</label> <label>Phone Calls</label>
<description>Provides various informations regarding the phone calls</description> <description>Provides various informations regarding the phone calls</description>
<channel-groups> <channel-groups>