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

Fix #17262

Also remove the unused class LanlineConfiguration

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
This commit is contained in:
lolodomo 2024-08-17 20:03:03 +02:00 committed by Ciprian Pascu
parent e02ac2cd11
commit bb99ffcba8
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) {
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);
}
}

View 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);
}
}

View 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>

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.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

View 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>