super(thing);
}
+ @Override
+ protected void internalPoll() throws FreeboxException {
+ if (isLinked(TELEPHONY_SERVICE) || isLinked(DECT_ACTIVE) || isLinked(ALTERNATE_RING)) {
+ Config config = getManager(PhoneManager.class).getConfig();
+ updateConfigChannels(config);
+ }
+
+ if (isLinked(ONHOOK) || isLinked(RINGING) || isLinked(HARDWARE_STATUS) || isLinked(GAIN_RX)
+ || isLinked(GAIN_TX)) {
+ getManager(PhoneManager.class).getStatus(getClientId()).ifPresent(this::updateStatusChannels);
+ }
+ }
+
@Override
protected void updateConfigChannels(Config config) {
super.updateConfigChannels(config);
import org.openhab.binding.freeboxos.internal.api.rest.PhoneManager.Status;
import org.openhab.core.library.types.OnOffType;
import org.openhab.core.thing.Thing;
-import org.openhab.core.thing.ThingStatus;
import org.openhab.core.types.Command;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
protected void internalPoll() throws FreeboxException {
logger.debug("Polling landline status...");
- Config config = getManager(PhoneManager.class).getConfig();
- updateConfigChannels(config);
+ if (isLinked(TELEPHONY_SERVICE)) {
+ Config config = getManager(PhoneManager.class).getConfig();
+ updateConfigChannels(config);
+ }
- getManager(PhoneManager.class).getStatus(getClientId()).ifPresent(this::updateStatusChannels);
+ if (isLinked(ONHOOK) || isLinked(RINGING) || isLinked(HARDWARE_STATUS)) {
+ getManager(PhoneManager.class).getStatus(getClientId()).ifPresent(this::updateStatusChannels);
+ }
}
protected void updateConfigChannels(Config config) {
updateChannelOnOff(ONHOOK, status.onHook());
updateChannelOnOff(RINGING, status.isRinging());
updateChannelString(HARDWARE_STATUS, status.hardwareDefect() ? "KO" : "OK");
- updateStatus(ThingStatus.ONLINE);
}
@Override