[lgthinq][fix] review fixes

[lgthinq][fix] Refrigerator channel command handle fixes

Signed-off-by: Nemer Daud <nemer@smartsw.com.br>
This commit is contained in:
Nemer Daud 2024-12-23 22:29:36 -03:00
parent 1b57051411
commit 375aef6b08
49 changed files with 463 additions and 1151 deletions

View File

@ -46,8 +46,7 @@ public class LGThinQBindingConstants extends LGServicesConstants {
public static final ThingTypeUID THING_TYPE_DRYER_TOWER = new ThingTypeUID(BINDING_ID,
DeviceTypes.DRYER_TOWER.thingTypeId());
public static final ThingTypeUID THING_TYPE_FRIDGE = new ThingTypeUID(BINDING_ID,
DeviceTypes.REFRIGERATOR.thingTypeId());
public static final ThingTypeUID THING_TYPE_FRIDGE = new ThingTypeUID(BINDING_ID, DeviceTypes.FRIDGE.thingTypeId());
public static final ThingTypeUID THING_TYPE_DISHWASHER = new ThingTypeUID(BINDING_ID,
DeviceTypes.DISH_WASHER.thingTypeId());
public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Set.of(THING_TYPE_AIR_CONDITIONER,
@ -97,36 +96,36 @@ public class LGThinQBindingConstants extends LGServicesConstants {
public static final String CHANNEL_AC_TARGET_TEMP_ID = "target-temperature";
/**
* ============ Refrigerator's Channels & Constant Definition =============
* ============ Fridge's Channels & Constant Definition =============
*/
public static final String CHANNEL_RE_ACTIVE_SAVING = "fr-active-saving";
public static final String CHANNEL_RE_DOOR_OPEN = "some-door-open";
public static final String CHANNEL_RE_EXPRESS_COOL_MODE = "fr-express-cool-mode";
public static final String CHANNEL_RE_EXPRESS_FREEZE_MODE = "fr-express-mode";
public static final String CHANNEL_RE_FREEZER_TEMP_ID = "freezer-temperature";
public static final String CHANNEL_RE_FRESH_AIR_FILTER = "fr-fresh-air-filter";
public static final String CHANNEL_RE_FRIDGE_TEMP_ID = "fridge-temperature";
public static final String CHANNEL_RE_ICE_PLUS = "fr-ice-plus";
public static final String CHANNEL_RE_REF_TEMP_UNIT = "temp-unit";
public static final String CHANNEL_RE_SMART_SAVING_MODE_V2 = "fr-smart-saving-mode";
public static final String CHANNEL_RE_SMART_SAVING_SWITCH_V1 = "fr-smart-saving-switch";
public static final String CHANNEL_RE_VACATION_MODE = "fr-eco-friendly-mode";
public static final String CHANNEL_RE_WATER_FILTER = "fr-water-filter";
public static final String CHANNEL_FR_ACTIVE_SAVING = "fr-active-saving";
public static final String CHANNEL_FR_DOOR_OPEN = "fr-some-door-open";
public static final String CHANNEL_FR_EXPRESS_COOL_MODE = "fr-express-cool-mode";
public static final String CHANNEL_FR_EXPRESS_FREEZE_MODE = "fr-express-mode";
public static final String CHANNEL_FR_FREEZER_TEMP_ID = "fr-freezer-temperature";
public static final String CHANNEL_FR_FRESH_AIR_FILTER = "fr-fresh-air-filter";
public static final String CHANNEL_FR_FRIDGE_TEMP_ID = "fr-fridge-temperature";
public static final String CHANNEL_FR_ICE_PLUS = "fr-ice-plus";
public static final String CHANNEL_FR_REF_TEMP_UNIT = "fr-temp-unit";
public static final String CHANNEL_FR_SMART_SAVING_MODE_V2 = "fr-smart-saving-mode";
public static final String CHANNEL_FR_SMART_SAVING_SWITCH_V1 = "fr-smart-saving-switch";
public static final String CHANNEL_FR_VACATION_MODE = "fr-eco-friendly-mode";
public static final String CHANNEL_FR_WATER_FILTER = "fr-water-filter";
/**
* ============ Washing Machine/Dryer and DishWasher Channels & Constant Definition =============
* DishWasher, Washing Machine and Dryer have the same channel core and features
*/
public static final String CHANNEL_DR_CHILD_LOCK_ID = "child-lock";
public static final String CHANNEL_DR_DRY_LEVEL_ID = "dry-level";
public static final String CHANNEL_WMD_CHILD_LOCK_ID = "child-lock";
public static final String CHANNEL_WMD_DRY_LEVEL_ID = "dry-level";
public static final String CHANNEL_WMD_COURSE_ID = "course";
public static final String CHANNEL_WMD_DELAY_TIME_ID = "delay-time";
public static final String CHANNEL_WMD_DOOR_LOCK_ID = "door-lock";
public static final String CHANNEL_WMD_PROCESS_STATE_ID = "process-state";
public static final String CHANNEL_WMD_REMAIN_TIME_ID = "remain-time";
public static final String CHANNEL_WMD_REMOTE_COURSE = "rs-course";
public static final String CHANNEL_WMD_REMOTE_START_GRP_ID = "remote-start-grp";
public static final String CHANNEL_WMD_REMOTE_START_ID = "remote-start-flag";
public static final String CHANNEL_WMD_REMOTE_START_GRP_ID = "rs-grp";
public static final String CHANNEL_WMD_REMOTE_START_ID = "rs-flag";
public static final String CHANNEL_WMD_REMOTE_START_START_STOP = "rs-start-stop";
public static final String CHANNEL_WMD_RINSE_ID = "rinse";
public static final String CHANNEL_WMD_SMART_COURSE_ID = "smart-course";
@ -134,9 +133,9 @@ public class LGThinQBindingConstants extends LGServicesConstants {
public static final String CHANNEL_WMD_STAND_BY_ID = "stand-by";
public static final String CHANNEL_WMD_STATE_ID = "state";
public static final String CHANNEL_WMD_TEMP_LEVEL_ID = "temperature-level";
public static final String CHANNEL_WM_REMOTE_START_RINSE = "rs-rinse";
public static final String CHANNEL_WM_REMOTE_START_SPIN = "rs-spin";
public static final String CHANNEL_WM_REMOTE_START_TEMP = "rs-temperature-level";
public static final String CHANNEL_WMD_REMOTE_START_RINSE = "rs-rinse";
public static final String CHANNEL_WMD_REMOTE_START_SPIN = "rs-spin";
public static final String CHANNEL_WMD_REMOTE_START_TEMP = "rs-temperature-level";
// ==============================================================================
// DIGEST CONSTANTS

View File

@ -28,8 +28,8 @@ public class LGThinQBridgeConfiguration {
public String password = "";
public String country = "";
public String language = "";
public final String manualCountry = "";
public final String manualLanguage = "";
public String manualCountry = "";
public String manualLanguage = "";
public int pollingIntervalSec = 0;
public String alternativeServer = "";
@ -72,31 +72,7 @@ public class LGThinQBridgeConfiguration {
return pollingIntervalSec;
}
public void setUsername(String username) {
this.username = username;
}
public void setPassword(String password) {
this.password = password;
}
public void setCountry(String country) {
this.country = country;
}
public void setLanguage(String language) {
this.language = language;
}
public void setPollingIntervalSec(int pollingIntervalSec) {
this.pollingIntervalSec = pollingIntervalSec;
}
public String getAlternativeServer() {
return alternativeServer;
}
public void setAlternativeServer(String alternativeServer) {
this.alternativeServer = alternativeServer;
}
}

View File

@ -31,8 +31,6 @@ import org.openhab.binding.lgthinq.internal.handler.LGThinQBridgeHandler;
import org.openhab.binding.lgthinq.internal.handler.LGThinQDishWasherHandler;
import org.openhab.binding.lgthinq.internal.handler.LGThinQFridgeHandler;
import org.openhab.binding.lgthinq.internal.handler.LGThinQWasherDryerHandler;
import org.openhab.binding.lgthinq.internal.type.ThinqChannelGroupTypeProvider;
import org.openhab.binding.lgthinq.internal.type.ThinqChannelTypeProvider;
import org.openhab.core.config.core.Configuration;
import org.openhab.core.io.net.http.HttpClientFactory;
import org.openhab.core.thing.Bridge;
@ -65,12 +63,6 @@ public class LGThinQHandlerFactory extends BaseThingHandlerFactory {
private final LGThinQStateDescriptionProvider stateDescriptionProvider;
@Nullable
@Reference
protected ThinqChannelTypeProvider thinqChannelProvider;
@Nullable
@Reference
protected ThinqChannelGroupTypeProvider thinqChannelGroupProvider;
@Nullable
@Reference
protected ItemChannelLinkRegistry itemChannelLinkRegistry;
@ -97,18 +89,15 @@ public class LGThinQHandlerFactory extends BaseThingHandlerFactory {
return new LGThinQBridgeHandler((Bridge) thing, httpClientFactory);
} else if (THING_TYPE_WASHING_MACHINE.equals(thingTypeUID) || THING_TYPE_WASHING_TOWER.equals(thingTypeUID)) {
return new LGThinQWasherDryerHandler(thing, stateDescriptionProvider,
Objects.requireNonNull(thinqChannelProvider), Objects.requireNonNull(thinqChannelGroupProvider),
Objects.requireNonNull(itemChannelLinkRegistry), httpClientFactory);
} else if (THING_TYPE_DRYER.equals(thingTypeUID) || THING_TYPE_DRYER_TOWER.equals(thingTypeUID)) {
return new LGThinQWasherDryerHandler(thing, stateDescriptionProvider,
Objects.requireNonNull(thinqChannelProvider), Objects.requireNonNull(thinqChannelGroupProvider),
Objects.requireNonNull(itemChannelLinkRegistry), httpClientFactory);
} else if (THING_TYPE_FRIDGE.equals(thingTypeUID)) {
return new LGThinQFridgeHandler(thing, stateDescriptionProvider,
Objects.requireNonNull(itemChannelLinkRegistry), httpClientFactory);
} else if (THING_TYPE_DISHWASHER.equals(thingTypeUID)) {
return new LGThinQDishWasherHandler(thing, stateDescriptionProvider,
Objects.requireNonNull(thinqChannelProvider), Objects.requireNonNull(thinqChannelGroupProvider),
Objects.requireNonNull(itemChannelLinkRegistry), httpClientFactory);
}
logger.warn("Thing not supported by this Factory: {}", thingTypeUID.getId());

View File

@ -51,7 +51,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* The {@link LGThinqDiscoveryService}
* The {@link LGThinqDiscoveryService} - Responsable to discovery new LG Thinq Devices for the registered Bridge
*
* @author Nemer Daud - Initial contribution
*/
@ -147,7 +147,7 @@ public class LGThinqDiscoveryService extends AbstractThingHandlerDiscoveryServic
case WASHER_TOWER -> THING_TYPE_WASHING_TOWER;
case DRYER_TOWER -> THING_TYPE_DRYER_TOWER;
case DRYER -> THING_TYPE_DRYER;
case REFRIGERATOR -> THING_TYPE_FRIDGE;
case FRIDGE -> THING_TYPE_FRIDGE;
case DISH_WASHER -> THING_TYPE_DISHWASHER;
default ->
throw new LGThinqException(String.format("device type [%s] not supported", device.getDeviceType()));

View File

@ -42,9 +42,8 @@ import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.lgthinq.internal.LGThinQStateDescriptionProvider;
import org.openhab.binding.lgthinq.internal.type.ThinqChannelGroupTypeProvider;
import org.openhab.binding.lgthinq.internal.type.ThinqChannelTypeProvider;
import org.openhab.binding.lgthinq.lgservices.LGThinQApiClientService;
import org.openhab.binding.lgthinq.lgservices.errors.LGThinqAccessException;
import org.openhab.binding.lgthinq.lgservices.errors.LGThinqApiException;
import org.openhab.binding.lgthinq.lgservices.errors.LGThinqApiExhaustionException;
import org.openhab.binding.lgthinq.lgservices.errors.LGThinqDeviceV1MonitorExpiredException;
@ -114,10 +113,6 @@ public abstract class LGThinQAbstractDeviceHandler<@NonNull C extends Capability
ThingStatusDetail.CONFIGURATION_ERROR);
protected final LGThinQStateDescriptionProvider stateDescriptionProvider;
@Nullable
protected ThinqChannelTypeProvider thinqChannelProvider;
@Nullable
protected ThinqChannelGroupTypeProvider thinqChannelGroupProvider;
protected S getLastShot() {
return Objects.requireNonNull(lastShot, "LastShot shouldn't be null. It most likely a bug.");
@ -513,6 +508,8 @@ public abstract class LGThinQAbstractDeviceHandler<@NonNull C extends Capability
updateStatus(ThingStatus.ONLINE);
}
} catch (LGThinqAccessException e) {
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, e.getMessage());
} catch (LGThinqApiExhaustionException e) {
fetchMonitorRetries++;
getLogger().warn("LG API returns null monitoring data for the thing {}/{}. No data available yet ?",

View File

@ -86,8 +86,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
/**
* The {@link LGThinQAirConditionerHandler} is responsible for handling commands, which are
* sent to one of the channels.
* The {@link LGThinQAirConditionerHandler} Handle Air Conditioner and HeatPump Things
*
* @author Nemer Daud - Initial contribution
*/

View File

@ -18,22 +18,32 @@ import org.openhab.binding.lgthinq.lgservices.model.CapabilityDefinition;
import org.openhab.binding.lgthinq.lgservices.model.SnapshotDefinition;
/**
* The {@link LGThinQBridge}
* The {@link LGThinQBridge} - Specific methods for discovery integration
*
* @author Nemer Daud - Initial contribution
*/
@NonNullByDefault
public interface LGThinQBridge {
/**
* Register
* Register Discovery Listener
*
* @param listener
*/
void registerDiscoveryListener(LGThinqDiscoveryService listener);
/**
* Registry a device Thing to the bridge
*
* @param thing Thing to be registered.
*/
void registryListenerThing(
LGThinQAbstractDeviceHandler<? extends CapabilityDefinition, ? extends SnapshotDefinition> thing);
/**
* Unregistry the thing
*
* @param thing to be unregistered
*/
void unRegistryListenerThing(
LGThinQAbstractDeviceHandler<? extends CapabilityDefinition, ? extends SnapshotDefinition> thing);
}

View File

@ -54,7 +54,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* The {@link LGThinQBridgeHandler}
* The {@link LGThinQBridgeHandler} - connect to the LG Account and get information about the user and registered
* devices of that user.
*
* @author Nemer Daud - Initial contribution
*/
@ -129,6 +130,7 @@ public class LGThinQBridgeHandler extends ConfigStatusBridgeHandler implements L
} catch (RefreshTokenException e) {
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.HANDLER_INITIALIZING_ERROR,
"@text/error.toke-refresh");
logger.error("Error refreshing token", e);
return;
}
} else {

View File

@ -34,8 +34,6 @@ import java.util.List;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.binding.lgthinq.internal.LGThinQStateDescriptionProvider;
import org.openhab.binding.lgthinq.internal.type.ThinqChannelGroupTypeProvider;
import org.openhab.binding.lgthinq.internal.type.ThinqChannelTypeProvider;
import org.openhab.binding.lgthinq.lgservices.LGThinQApiClientService;
import org.openhab.binding.lgthinq.lgservices.LGThinQApiClientServiceFactory;
import org.openhab.binding.lgthinq.lgservices.LGThinQDishWasherApiClientService;
@ -56,8 +54,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* The {@link LGThinQDishWasherHandler} is responsible for handling commands, which are
* sent to one of the channels.
* The {@link LGThinQDishWasherHandler} Handle the Dish Washer Things
*
* @author Nemer Daud - Initial contribution
*/
@ -78,11 +75,8 @@ public class LGThinQDishWasherHandler extends LGThinQAbstractDeviceHandler<DishW
private final LGThinQDishWasherApiClientService lgThinqDishWasherApiClientService;
public LGThinQDishWasherHandler(Thing thing, LGThinQStateDescriptionProvider stateDescriptionProvider,
ThinqChannelTypeProvider channelTypeProvider, ThinqChannelGroupTypeProvider channelGroupTypeProvider,
ItemChannelLinkRegistry itemChannelLinkRegistry, HttpClientFactory httpClientFactory) {
super(thing, stateDescriptionProvider, itemChannelLinkRegistry);
this.thinqChannelGroupProvider = channelGroupTypeProvider;
this.thinqChannelProvider = channelTypeProvider;
this.stateDescriptionProvider = stateDescriptionProvider;
lgThinqDishWasherApiClientService = LGThinQApiClientServiceFactory.newDishWasherApiClientService(lgPlatformType,
httpClientFactory);

View File

@ -14,19 +14,19 @@ package org.openhab.binding.lgthinq.internal.handler;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_DASHBOARD_GRP_ID;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_EXTENDED_INFO_GRP_ID;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_RE_ACTIVE_SAVING;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_RE_DOOR_OPEN;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_RE_EXPRESS_COOL_MODE;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_RE_EXPRESS_FREEZE_MODE;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_RE_FREEZER_TEMP_ID;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_RE_FRESH_AIR_FILTER;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_RE_FRIDGE_TEMP_ID;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_RE_ICE_PLUS;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_RE_REF_TEMP_UNIT;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_RE_SMART_SAVING_MODE_V2;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_RE_SMART_SAVING_SWITCH_V1;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_RE_VACATION_MODE;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_RE_WATER_FILTER;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_FR_ACTIVE_SAVING;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_FR_DOOR_OPEN;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_FR_EXPRESS_COOL_MODE;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_FR_EXPRESS_FREEZE_MODE;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_FR_FREEZER_TEMP_ID;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_FR_FRESH_AIR_FILTER;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_FR_FRIDGE_TEMP_ID;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_FR_ICE_PLUS;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_FR_REF_TEMP_UNIT;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_FR_SMART_SAVING_MODE_V2;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_FR_SMART_SAVING_SWITCH_V1;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_FR_VACATION_MODE;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_FR_WATER_FILTER;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.PROP_INFO_DEVICE_ALIAS;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.PROP_INFO_MODEL_URL_INFO;
import static org.openhab.binding.lgthinq.lgservices.LGServicesConstants.CAP_RE_FRESH_AIR_FILTER_MAP;
@ -76,8 +76,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* The {@link LGThinQFridgeHandler} is responsible for handling commands, which are
* sent to one of the channels.
* The {@link LGThinQFridgeHandler} Handle Fridge things
*
* @author Nemer Daud - Initial contribution
* @author Arne Seime - Complementary sensors
@ -110,20 +109,20 @@ public class LGThinQFridgeHandler extends LGThinQAbstractDeviceHandler<FridgeCap
httpClientFactory);
channelGroupDashboardUID = new ChannelGroupUID(getThing().getUID(), CHANNEL_DASHBOARD_GRP_ID);
channelGroupExtendedInfoUID = new ChannelGroupUID(getThing().getUID(), CHANNEL_EXTENDED_INFO_GRP_ID);
fridgeTempChannelUID = new ChannelUID(channelGroupDashboardUID, CHANNEL_RE_FRIDGE_TEMP_ID);
freezerTempChannelUID = new ChannelUID(channelGroupDashboardUID, CHANNEL_RE_FREEZER_TEMP_ID);
doorChannelUID = new ChannelUID(channelGroupDashboardUID, CHANNEL_RE_DOOR_OPEN);
tempUnitUID = new ChannelUID(channelGroupDashboardUID, CHANNEL_RE_REF_TEMP_UNIT);
icePlusChannelUID = new ChannelUID(channelGroupDashboardUID, CHANNEL_RE_ICE_PLUS);
expressFreezeModeChannelUID = new ChannelUID(channelGroupDashboardUID, CHANNEL_RE_EXPRESS_FREEZE_MODE);
expressCoolModeChannelUID = new ChannelUID(channelGroupDashboardUID, CHANNEL_RE_EXPRESS_COOL_MODE);
vacationModeChannelUID = new ChannelUID(channelGroupDashboardUID, CHANNEL_RE_VACATION_MODE);
fridgeTempChannelUID = new ChannelUID(channelGroupDashboardUID, CHANNEL_FR_FRIDGE_TEMP_ID);
freezerTempChannelUID = new ChannelUID(channelGroupDashboardUID, CHANNEL_FR_FREEZER_TEMP_ID);
doorChannelUID = new ChannelUID(channelGroupDashboardUID, CHANNEL_FR_DOOR_OPEN);
tempUnitUID = new ChannelUID(channelGroupDashboardUID, CHANNEL_FR_REF_TEMP_UNIT);
icePlusChannelUID = new ChannelUID(channelGroupDashboardUID, CHANNEL_FR_ICE_PLUS);
expressFreezeModeChannelUID = new ChannelUID(channelGroupDashboardUID, CHANNEL_FR_EXPRESS_FREEZE_MODE);
expressCoolModeChannelUID = new ChannelUID(channelGroupDashboardUID, CHANNEL_FR_EXPRESS_COOL_MODE);
vacationModeChannelUID = new ChannelUID(channelGroupDashboardUID, CHANNEL_FR_VACATION_MODE);
smartSavingModeChannelUID = new ChannelUID(channelGroupDashboardUID,
LG_API_PLATFORM_TYPE_V2.equals(lgPlatformType) ? CHANNEL_RE_SMART_SAVING_MODE_V2
: CHANNEL_RE_SMART_SAVING_SWITCH_V1);
activeSavingChannelUID = new ChannelUID(channelGroupDashboardUID, CHANNEL_RE_ACTIVE_SAVING);
freshAirFilterChannelUID = new ChannelUID(channelGroupExtendedInfoUID, CHANNEL_RE_FRESH_AIR_FILTER);
waterFilterChannelUID = new ChannelUID(channelGroupExtendedInfoUID, CHANNEL_RE_WATER_FILTER);
LG_API_PLATFORM_TYPE_V2.equals(lgPlatformType) ? CHANNEL_FR_SMART_SAVING_MODE_V2
: CHANNEL_FR_SMART_SAVING_SWITCH_V1);
activeSavingChannelUID = new ChannelUID(channelGroupDashboardUID, CHANNEL_FR_ACTIVE_SAVING);
freshAirFilterChannelUID = new ChannelUID(channelGroupExtendedInfoUID, CHANNEL_FR_FRESH_AIR_FILTER);
waterFilterChannelUID = new ChannelUID(channelGroupExtendedInfoUID, CHANNEL_FR_WATER_FILTER);
}
private Unit<Temperature> getTemperatureUnit(FridgeCanonicalSnapshot shot) {
@ -198,8 +197,7 @@ public class LGThinQFridgeHandler extends LGThinQAbstractDeviceHandler<FridgeCap
return 0;
}
// temperature channels are little different. First we need to get the tempUnit in the first snapshot,
Map<String, String> convertionMap = new HashMap<>();
convertionMap = getConvertionMap(ch, refCap);
Map<String, String> convertionMap = getConvertionMap(ch, refCap);
String strValue = convertionMap.get(value.toString());
if (strValue == null) {
logger.error(
@ -224,8 +222,7 @@ public class LGThinQFridgeHandler extends LGThinQAbstractDeviceHandler<FridgeCap
return 0;
}
// temperature channels are little different. First we need to get the tempUnit in the first snapshot,
final Map<String, String> convertionMap = new HashMap<>();
getConvertionMap(ch, refCap);
final Map<String, String> convertionMap = getConvertionMap(ch, refCap);
final Map<String, String> invertedMap = new HashMap<>();
convertionMap.forEach((k, v) -> {
invertedMap.put(v, k);
@ -293,12 +290,12 @@ public class LGThinQFridgeHandler extends LGThinQAbstractDeviceHandler<FridgeCap
@Override
public void updateChannelDynStateDescription() throws LGThinqApiException {
FridgeCapability cap = getCapabilities();
manageDynChannel(icePlusChannelUID, CHANNEL_RE_ICE_PLUS, "Switch", !cap.getIcePlusMap().isEmpty());
manageDynChannel(expressFreezeModeChannelUID, CHANNEL_RE_EXPRESS_FREEZE_MODE, "String",
manageDynChannel(icePlusChannelUID, CHANNEL_FR_ICE_PLUS, "Switch", !cap.getIcePlusMap().isEmpty());
manageDynChannel(expressFreezeModeChannelUID, CHANNEL_FR_EXPRESS_FREEZE_MODE, "String",
!cap.getExpressFreezeModeMap().isEmpty());
manageDynChannel(expressCoolModeChannelUID, CHANNEL_RE_EXPRESS_COOL_MODE, "Switch",
manageDynChannel(expressCoolModeChannelUID, CHANNEL_FR_EXPRESS_COOL_MODE, "Switch",
cap.isExpressCoolModePresent());
manageDynChannel(vacationModeChannelUID, CHANNEL_RE_VACATION_MODE, "Switch", cap.isEcoFriendlyModePresent());
manageDynChannel(vacationModeChannelUID, CHANNEL_FR_VACATION_MODE, "Switch", cap.isEcoFriendlyModePresent());
Unit<Temperature> unTemp = getTemperatureUnit(getLastShot());
if (SIUnits.CELSIUS.equals(unTemp)) {
@ -344,8 +341,8 @@ public class LGThinQFridgeHandler extends LGThinQAbstractDeviceHandler<FridgeCap
String simpleChannelUID;
simpleChannelUID = getSimpleChannelUID(params.channelUID);
switch (simpleChannelUID) {
case CHANNEL_RE_FREEZER_TEMP_ID:
case CHANNEL_RE_FRIDGE_TEMP_ID: {
case CHANNEL_FR_FREEZER_TEMP_ID:
case CHANNEL_FR_FRIDGE_TEMP_ID: {
int targetTemp;
if (command instanceof DecimalType) {
targetTemp = ((DecimalType) command).intValue();
@ -356,7 +353,7 @@ public class LGThinQFridgeHandler extends LGThinQAbstractDeviceHandler<FridgeCap
break;
}
if (CHANNEL_RE_FRIDGE_TEMP_ID.equals(simpleChannelUID)) {
if (CHANNEL_FR_FRIDGE_TEMP_ID.equals(simpleChannelUID)) {
targetTemp = encodeTempValue(fridgeTempChannelUID, targetTemp);
lgThinqFridgeApiClientService.setFridgeTemperature(getBridgeId(), getDeviceId(), getCapabilities(),
targetTemp, lastShot.getTempUnit(), cmdSnap);
@ -367,7 +364,7 @@ public class LGThinQFridgeHandler extends LGThinQAbstractDeviceHandler<FridgeCap
}
break;
}
case CHANNEL_RE_ICE_PLUS: {
case CHANNEL_FR_ICE_PLUS: {
if (command instanceof OnOffType) {
lgThinqFridgeApiClientService.setIcePlus(getBridgeId(), getDeviceId(), getCapabilities(),
OnOffType.ON.equals(command), cmdSnap);
@ -376,7 +373,7 @@ public class LGThinQFridgeHandler extends LGThinQAbstractDeviceHandler<FridgeCap
}
break;
}
case CHANNEL_RE_EXPRESS_FREEZE_MODE: {
case CHANNEL_FR_EXPRESS_FREEZE_MODE: {
String targetExpressMode;
if (command instanceof StringType) {
targetExpressMode = ((StringType) command).toString();
@ -388,7 +385,7 @@ public class LGThinQFridgeHandler extends LGThinQAbstractDeviceHandler<FridgeCap
lgThinqFridgeApiClientService.setExpressMode(getBridgeId(), getDeviceId(), targetExpressMode);
break;
}
case CHANNEL_RE_EXPRESS_COOL_MODE: {
case CHANNEL_FR_EXPRESS_COOL_MODE: {
if (command instanceof OnOffType) {
lgThinqFridgeApiClientService.setExpressCoolMode(getBridgeId(), getDeviceId(),
OnOffType.ON.equals(command));
@ -398,7 +395,7 @@ public class LGThinQFridgeHandler extends LGThinQAbstractDeviceHandler<FridgeCap
}
break;
}
case CHANNEL_RE_VACATION_MODE: {
case CHANNEL_FR_VACATION_MODE: {
if (command instanceof OnOffType) {
lgThinqFridgeApiClientService.setEcoFriendlyMode(getBridgeId(), getDeviceId(),
OnOffType.ON.equals(command));

View File

@ -14,26 +14,26 @@ package org.openhab.binding.lgthinq.internal.handler;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_AC_POWER_ID;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_DASHBOARD_GRP_ID;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_DR_CHILD_LOCK_ID;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_DR_DRY_LEVEL_ID;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_WMD_CHILD_LOCK_ID;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_WMD_COURSE_ID;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_WMD_DELAY_TIME_ID;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_WMD_DOOR_LOCK_ID;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_WMD_DRY_LEVEL_ID;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_WMD_PROCESS_STATE_ID;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_WMD_REMAIN_TIME_ID;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_WMD_REMOTE_COURSE;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_WMD_REMOTE_START_GRP_ID;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_WMD_REMOTE_START_ID;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_WMD_REMOTE_START_RINSE;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_WMD_REMOTE_START_SPIN;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_WMD_REMOTE_START_START_STOP;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_WMD_REMOTE_START_TEMP;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_WMD_RINSE_ID;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_WMD_SMART_COURSE_ID;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_WMD_SPIN_ID;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_WMD_STAND_BY_ID;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_WMD_STATE_ID;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_WMD_TEMP_LEVEL_ID;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_WM_REMOTE_START_RINSE;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_WM_REMOTE_START_SPIN;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_WM_REMOTE_START_TEMP;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.PROP_INFO_DEVICE_ALIAS;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.PROP_INFO_MODEL_URL_INFO;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.THING_TYPE_DRYER;
@ -60,8 +60,6 @@ import java.util.concurrent.CopyOnWriteArrayList;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.lgthinq.internal.LGThinQStateDescriptionProvider;
import org.openhab.binding.lgthinq.internal.type.ThinqChannelGroupTypeProvider;
import org.openhab.binding.lgthinq.internal.type.ThinqChannelTypeProvider;
import org.openhab.binding.lgthinq.lgservices.LGThinQApiClientService;
import org.openhab.binding.lgthinq.lgservices.LGThinQApiClientServiceFactory;
import org.openhab.binding.lgthinq.lgservices.LGThinQWMApiClientService;
@ -92,8 +90,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* The {@link LGThinQWasherDryerHandler} is responsible for handling commands, which are
* sent to one of the channels.
* The {@link LGThinQWasherDryerHandler} Handle Washer/Dryer And Washer Dryer Towers things
*
* @author Nemer Daud - Initial contribution
*/
@ -127,25 +124,22 @@ public class LGThinQWasherDryerHandler
private final LGThinQWMApiClientService lgThinqWMApiClientService;
public LGThinQWasherDryerHandler(Thing thing, LGThinQStateDescriptionProvider stateDescriptionProvider,
ThinqChannelTypeProvider channelTypeProvider, ThinqChannelGroupTypeProvider channelGroupTypeProvider,
ItemChannelLinkRegistry itemChannelLinkRegistry, HttpClientFactory httpClientFactory) {
super(thing, stateDescriptionProvider, itemChannelLinkRegistry);
this.thinqChannelGroupProvider = channelGroupTypeProvider;
this.thinqChannelProvider = channelTypeProvider;
this.stateDescriptionProvider = stateDescriptionProvider;
lgThinqWMApiClientService = LGThinQApiClientServiceFactory.newWMApiClientService(lgPlatformType,
httpClientFactory);
channelGroupRemoteStartUID = new ChannelGroupUID(getThing().getUID(), CHANNEL_WMD_REMOTE_START_GRP_ID);
channelGroupDashboardUID = new ChannelGroupUID(getThing().getUID(), CHANNEL_DASHBOARD_GRP_ID);
courseChannelUID = new ChannelUID(channelGroupDashboardUID, CHANNEL_WMD_COURSE_ID);
dryLevelChannelUID = new ChannelUID(channelGroupDashboardUID, CHANNEL_DR_DRY_LEVEL_ID);
dryLevelChannelUID = new ChannelUID(channelGroupDashboardUID, CHANNEL_WMD_DRY_LEVEL_ID);
stateChannelUID = new ChannelUID(channelGroupDashboardUID, CHANNEL_WMD_STATE_ID);
processStateChannelUID = new ChannelUID(channelGroupDashboardUID, CHANNEL_WMD_PROCESS_STATE_ID);
remainTimeChannelUID = new ChannelUID(channelGroupDashboardUID, CHANNEL_WMD_REMAIN_TIME_ID);
delayTimeChannelUID = new ChannelUID(channelGroupDashboardUID, CHANNEL_WMD_DELAY_TIME_ID);
temperatureChannelUID = new ChannelUID(channelGroupDashboardUID, CHANNEL_WMD_TEMP_LEVEL_ID);
doorLockChannelUID = new ChannelUID(channelGroupDashboardUID, CHANNEL_WMD_DOOR_LOCK_ID);
childLockChannelUID = new ChannelUID(channelGroupDashboardUID, CHANNEL_DR_CHILD_LOCK_ID);
childLockChannelUID = new ChannelUID(channelGroupDashboardUID, CHANNEL_WMD_CHILD_LOCK_ID);
rinseChannelUID = new ChannelUID(channelGroupDashboardUID, CHANNEL_WMD_RINSE_ID);
spinChannelUID = new ChannelUID(channelGroupDashboardUID, CHANNEL_WMD_SPIN_ID);
standByModeChannelUID = new ChannelUID(channelGroupDashboardUID, CHANNEL_WMD_STAND_BY_ID);
@ -369,13 +363,13 @@ public class LGThinQWasherDryerHandler
String value = Objects.requireNonNullElse(getItemLinkedValue(c.getUID()), "");
String simpleChannelUID = getSimpleChannelUID(c.getUID().getId());
switch (simpleChannelUID) {
case CHANNEL_WM_REMOTE_START_RINSE:
case CHANNEL_WMD_REMOTE_START_RINSE:
data.put(cap.getRinseFeat().getName(), value);
break;
case CHANNEL_WM_REMOTE_START_TEMP:
case CHANNEL_WMD_REMOTE_START_TEMP:
data.put(cap.getTemperatureFeat().getName(), value);
break;
case CHANNEL_WM_REMOTE_START_SPIN:
case CHANNEL_WMD_REMOTE_START_SPIN:
data.put(cap.getSpinFeat().getName(), value);
break;
default:

View File

@ -1,56 +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.lgthinq.internal.model;
import java.util.List;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.types.StateOption;
/**
* The {@link DataType} class.
*
* @author Nemer Daud - Initial contribution
*/
@NonNullByDefault
public class DataType {
private final String name;
private final boolean isNumeric;
private final boolean isEnum;
@Nullable
private final List<StateOption> options;
public DataType(String name, boolean isNumeric, boolean isEnum, @Nullable List<StateOption> options) {
this.name = name;
this.isNumeric = isNumeric;
this.isEnum = isEnum;
this.options = options;
}
public @Nullable List<StateOption> getOptions() {
return options;
}
public String getName() {
return name;
}
public boolean isNumeric() {
return isNumeric;
}
public boolean isEnum() {
return isEnum;
}
}

View File

@ -1,86 +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.lgthinq.internal.model;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.config.core.ConfigDescriptionParameter.Type;
import org.openhab.core.config.core.ParameterOption;
/**
* The {@link DeviceParameter} class.
*
* @author Nemer Daud - Initial contribution
*/
@NonNullByDefault
public class DeviceParameter {
private final String name;
private final Type type;
private final String label;
private final String description;
private final String defaultValue;
private DeviceParameterGroup group = new DeviceParameterGroup("", "");
private final List<ParameterOption> options = new ArrayList<ParameterOption>();
private final boolean isReadOnly;
public DeviceParameter(String name, Type type, String label, String description, String defaultValue,
List<ParameterOption> options, boolean isReadOnly) {
this.name = name;
this.type = type;
this.label = label;
this.description = description;
this.defaultValue = defaultValue;
this.options.addAll(options);
this.isReadOnly = isReadOnly;
}
public DeviceParameterGroup getGroup() {
return group;
}
public void setGroup(DeviceParameterGroup group) {
this.group = group;
}
public List<ParameterOption> getOptions() {
return options;
}
public boolean isReadOnly() {
return isReadOnly;
}
public String getName() {
return name;
}
public Type getType() {
return type;
}
public String getLabel() {
return label;
}
public String getDescription() {
return description;
}
public String getDefaultValue() {
return defaultValue;
}
}

View File

@ -1,40 +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.lgthinq.internal.model;
import org.eclipse.jdt.annotation.NonNullByDefault;
/**
* The {@link DeviceParameterGroup} class.
*
* @author Nemer Daud - Initial contribution
*/
@NonNullByDefault
public class DeviceParameterGroup {
private final String groupName;
private final String groupLabel;
public DeviceParameterGroup(String groupName, String groupLabel) {
this.groupName = groupName;
this.groupLabel = groupLabel;
}
public String getGroupName() {
return groupName;
}
public String getGroupLabel() {
return groupLabel;
}
}

View File

@ -1,115 +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.lgthinq.internal.model;
import java.util.Objects;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
/**
* The {@link ThinqChannel} class.
*
* @author Nemer Daud - Initial contribution
*/
@NonNullByDefault
public class ThinqChannel {
@Nullable
ThinqDevice device;
private final DataType type;
@Nullable
private final String unitDisplayPattern;
private final String name;
private final String label;
private final String description;
private final boolean isDynamic;
private final boolean isReadOnly;
private final boolean isAdvanced;
@Nullable
private final ThinqChannelGroup channelGroup;
@Override
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ThinqChannel that = (ThinqChannel) o;
return Objects.equals(name, that.name);
}
@Override
public int hashCode() {
return Objects.hash(name);
}
public ThinqChannel(DataType type, @Nullable String unitDisplayPattern, String name, String label,
String description, boolean isDynamic, boolean isReadOnly, boolean isAdvanced,
@Nullable ThinqChannelGroup channelGroup) {
this.type = type;
this.unitDisplayPattern = unitDisplayPattern;
this.name = name;
this.label = label;
this.description = description;
this.isDynamic = isDynamic;
this.isReadOnly = isReadOnly;
this.isAdvanced = isAdvanced;
this.channelGroup = channelGroup;
if (channelGroup != null && !channelGroup.getChannels().contains(this)) {
channelGroup.getChannels().add(this);
}
}
public @Nullable ThinqChannelGroup getChannelGroup() {
return channelGroup;
}
public boolean isAdvanced() {
return isAdvanced;
}
public String getLabel() {
return label;
}
public boolean isReadOnly() {
return isReadOnly;
}
public @Nullable String getUnitDisplayPattern() {
return unitDisplayPattern;
}
public @Nullable ThinqDevice getDevice() {
return device;
}
public DataType getType() {
return type;
}
public boolean isDynamic() {
return isDynamic;
}
public String getName() {
return name;
}
public String getDescription() {
return description;
}
}

View File

@ -1,81 +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.lgthinq.internal.model;
import java.util.List;
import java.util.Objects;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
/**
* The {@link ThinqChannelGroup} class.
*
* @author Nemer Daud - Initial contribution
*/
@NonNullByDefault
public class ThinqChannelGroup {
private final List<ThinqChannel> channels;
private ThinqDevice device;
private final String name;
private final String description;
private final String label;
public ThinqChannelGroup(List<ThinqChannel> channels, ThinqDevice device, String name, String description,
String label) {
this.channels = channels;
this.device = device;
this.name = name;
this.description = description;
this.label = label;
}
@Override
public boolean equals(@Nullable Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
ThinqChannelGroup that = (ThinqChannelGroup) o;
return Objects.equals(name, that.name);
}
@Override
public int hashCode() {
return Objects.hash(name);
}
public String getLabel() {
return label;
}
public List<ThinqChannel> getChannels() {
return channels;
}
public ThinqDevice getDevice() {
return device;
}
public void setDevice(ThinqDevice device) {
this.device = device;
}
public String getName() {
return name;
}
public String getDescription() {
return description;
}
}

View File

@ -1,73 +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.lgthinq.internal.model;
import java.util.List;
import org.eclipse.jdt.annotation.NonNullByDefault;
/**
* The {@link ThinqDevice} class.
*
* @author Nemer Daud - Initial contribution
*/
@NonNullByDefault
public class ThinqDevice {
private final String type;
private final String label;
private final String description;
private final List<ThinqChannel> channels;
private final List<DeviceParameter> configParameter;
private final List<ThinqChannelGroup> groups;
public String getType() {
return type;
}
public String getDescription() {
return description;
}
public List<ThinqChannel> getChannels() {
return channels;
}
public List<ThinqChannelGroup> getGroups() {
return groups;
}
public ThinqDevice(String type, String label, String description, List<ThinqChannel> channels,
List<DeviceParameter> configParameter, List<ThinqChannelGroup> groups) {
this.type = type;
this.label = label;
this.description = description;
this.channels = channels;
this.configParameter = configParameter;
this.groups = groups;
this.channels.forEach(c -> {
c.device = this;
});
this.groups.forEach(g -> {
g.setDevice(this);
});
}
public String getLabel() {
return label;
}
public List<DeviceParameter> getConfigParameter() {
return configParameter;
}
}

View File

@ -1,32 +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.lgthinq.internal.type;
import java.util.List;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.thing.type.ChannelGroupType;
import org.openhab.core.thing.type.ChannelGroupTypeProvider;
/**
* The ThinqChannelGroupTypeProvider interface.
*
* @author Nemer Daud - Initial contribution
*/
@NonNullByDefault
public interface ThinqChannelGroupTypeProvider extends ChannelGroupTypeProvider {
void addChannelGroupType(ChannelGroupType channelGroupType);
List<ChannelGroupType> internalGroupTypes();
}

View File

@ -1,27 +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.lgthinq.internal.type;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.thing.type.ChannelType;
import org.openhab.core.thing.type.ChannelTypeProvider;
/**
* The ThinqChannelTypeProvider interface.
*
* @author Nemer Daud - Initial contribution
*/
@NonNullByDefault
public interface ThinqChannelTypeProvider extends ChannelTypeProvider {
void addChannelType(final ChannelType channelType);
}

View File

@ -1,28 +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.lgthinq.internal.type;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.config.core.ConfigDescription;
import org.openhab.core.config.core.ConfigDescriptionProvider;
/**
* The ThinqConfigDescriptionProvider interface.
*
* @author Nemer Daud - Initial contribution
*/
@NonNullByDefault
public interface ThinqConfigDescriptionProvider extends ConfigDescriptionProvider {
void addConfigDescription(ConfigDescription configDescription);
}

View File

@ -1,28 +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.lgthinq.internal.type;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.thing.binding.ThingTypeProvider;
import org.openhab.core.thing.type.ThingType;
/**
* The ThinqThingTypeProvider interface.
*
* @author Nemer Daud - Initial contribution
*/
@NonNullByDefault
public interface ThinqThingTypeProvider extends ThingTypeProvider {
void addThingType(ThingType thingType);
}

View File

@ -1,127 +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.lgthinq.internal.type;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.config.core.ConfigDescription;
import org.openhab.core.config.core.ConfigDescriptionProvider;
import org.openhab.core.thing.ThingTypeUID;
import org.openhab.core.thing.binding.ThingTypeProvider;
import org.openhab.core.thing.type.ChannelGroupType;
import org.openhab.core.thing.type.ChannelGroupTypeProvider;
import org.openhab.core.thing.type.ChannelGroupTypeUID;
import org.openhab.core.thing.type.ChannelType;
import org.openhab.core.thing.type.ChannelTypeProvider;
import org.openhab.core.thing.type.ChannelTypeUID;
import org.openhab.core.thing.type.ThingType;
import org.osgi.service.component.annotations.Component;
/**
* Provider class to provide model types for custom things (not in XML).
*
* @author Nemer Daud - Initial contribution
*/
@NonNullByDefault
@Component(service = { ThinqChannelTypeProvider.class, ChannelTypeProvider.class, ChannelGroupTypeProvider.class,
ThinqChannelGroupTypeProvider.class, ThinqConfigDescriptionProvider.class, ConfigDescriptionProvider.class,
ThinqThingTypeProvider.class, ThingTypeProvider.class })
public class ThinqTypesProviderImpl implements ThinqChannelTypeProvider, ThinqChannelGroupTypeProvider,
ThinqConfigDescriptionProvider, ThinqThingTypeProvider {
private final Map<ThingTypeUID, ThingType> thingTypesByUID = new ConcurrentHashMap<>();
private final Map<ChannelTypeUID, ChannelType> channelTypesByUID = new ConcurrentHashMap<>();
private final Map<ChannelGroupTypeUID, ChannelGroupType> channelGroupTypesByUID = new ConcurrentHashMap<>();
private final Map<URI, ConfigDescription> configDescriptionsByURI = new ConcurrentHashMap<>();
@Override
public Collection<ChannelType> getChannelTypes(@Nullable final Locale locale) {
return Collections.unmodifiableCollection(channelTypesByUID.values());
}
@Override
public @Nullable ChannelType getChannelType(final ChannelTypeUID channelTypeUID, @Nullable final Locale locale) {
return channelTypesByUID.get(channelTypeUID);
}
/**
* Add a channel type for a user configured channel.
*
* @param channelType channelType
*/
@Override
public void addChannelType(final ChannelType channelType) {
channelTypesByUID.put(channelType.getUID(), channelType);
}
@Override
@Nullable
public ChannelGroupType getChannelGroupType(ChannelGroupTypeUID channelGroupTypeUID, @Nullable Locale locale) {
return channelGroupTypesByUID.get(channelGroupTypeUID);
}
@Override
public Collection<ChannelGroupType> getChannelGroupTypes(@Nullable Locale locale) {
return Collections.unmodifiableCollection(channelGroupTypesByUID.values());
}
@Override
public void addChannelGroupType(ChannelGroupType channelGroupType) {
channelGroupTypesByUID.put(channelGroupType.getUID(), channelGroupType);
}
@Override
public List<ChannelGroupType> internalGroupTypes() {
return new ArrayList<>(channelGroupTypesByUID.values());
}
@Override
public void addConfigDescription(ConfigDescription configDescription) {
configDescriptionsByURI.put(configDescription.getUID(), configDescription);
}
@Override
public Collection<ConfigDescription> getConfigDescriptions(@Nullable Locale locale) {
return Collections.unmodifiableCollection(configDescriptionsByURI.values());
}
@Override
public @Nullable ConfigDescription getConfigDescription(URI uri, @Nullable Locale locale) {
return configDescriptionsByURI.get(uri);
}
@Override
public void addThingType(ThingType thingType) {
thingTypesByUID.put(thingType.getUID(), thingType);
}
@Override
public Collection<ThingType> getThingTypes(@Nullable Locale locale) {
return Collections.unmodifiableCollection(thingTypesByUID.values());
}
@Override
public @Nullable ThingType getThingType(ThingTypeUID thingTypeUID, @Nullable Locale locale) {
return thingTypesByUID.get(thingTypeUID);
}
}

View File

@ -1,68 +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.lgthinq.internal.type;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.BINDING_ID;
import java.util.Objects;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.binding.lgthinq.internal.model.ThinqChannel;
import org.openhab.binding.lgthinq.internal.model.ThinqChannelGroup;
import org.openhab.binding.lgthinq.internal.model.ThinqDevice;
import org.openhab.core.thing.ChannelUID;
import org.openhab.core.thing.ThingTypeUID;
import org.openhab.core.thing.ThingUID;
import org.openhab.core.thing.type.ChannelGroupTypeUID;
import org.openhab.core.thing.type.ChannelTypeUID;
/**
* Utility class for generating some UIDs.
*
* @author Nemer Daud - Initial contribution
*/
@NonNullByDefault
public class UidUtils {
/**
* Generates the ThingTypeUID for the given device.
*/
public static ThingTypeUID generateThingTypeUID(ThinqDevice device) {
return new ThingTypeUID(BINDING_ID, device.getType());
}
/**
* Generates the ChannelTypeUID.
*/
public static ChannelTypeUID generateChannelTypeUID(ThinqChannel channel) {
return new ChannelTypeUID(BINDING_ID,
String.format("%s_%s",
Objects.requireNonNull(channel.getDevice(), "unexpected null device type here").getType(),
channel.getName()));
}
/**
* Generates the ChannelTypeUID for the given channel group.
*/
public static ChannelGroupTypeUID generateChannelGroupTypeUID(ThinqChannelGroup grpChannel) {
return new ChannelGroupTypeUID(BINDING_ID,
String.format("%s_%s", grpChannel.getDevice().getType(), grpChannel.getName()));
}
/**
* Generates the ChannelUID for the given datapoint with channelNumber and datapointName.
*/
public static ChannelUID generateChannelUID(ThinqChannel dp, ThingUID thingUID) {
return new ChannelUID(thingUID, dp.getName(), dp.getName());
}
}

View File

@ -20,32 +20,116 @@ import org.openhab.binding.lgthinq.lgservices.model.devices.ac.ACTargetTmp;
import org.openhab.binding.lgthinq.lgservices.model.devices.ac.ExtendedDeviceInfo;
/**
* The {@link LGThinQACApiClientService}
* The {@link LGThinQACApiClientService} - Common interface to be used by the AC Handle to access LG API Services in V1
* & v2
* protocol versions
*
* @author Nemer Daud - Initial contribution
*/
@NonNullByDefault
public interface LGThinQACApiClientService extends LGThinQApiClientService<ACCapability, ACCanonicalSnapshot> {
/**
* Change AC Operation Mode (Cool, Heat, etc.)
*
* @param bridgeName - name of the bridge
* @param deviceId - ID of the LG Thinq Device
* @param newOpMode - The new operation mode to be setup
* @throws LGThinqApiException - If some error invoking LG API.
*/
void changeOperationMode(String bridgeName, String deviceId, int newOpMode) throws LGThinqApiException;
/**
* Change the AC Fan Speed.
*
* @param bridgeName - name of the bridge
* @param deviceId - ID of the LG Thinq Device
* @param newFanSpeed - new Fan Speed to be setup
* @throws LGThinqApiException - If some error invoking LG API.
*/
void changeFanSpeed(String bridgeName, String deviceId, int newFanSpeed) throws LGThinqApiException;
/**
* Change the fan vertical orientation
*
* @param bridgeName - name of the bridge
* @param deviceId - ID of the LG Thinq Device
* @param currentSnap - Current data snapshot
* @param newStep - new vertical position
* @throws LGThinqApiException - If some error invoking LG API.
*/
void changeStepUpDown(String bridgeName, String deviceId, ACCanonicalSnapshot currentSnap, int newStep)
throws LGThinqApiException;
/**
* Change the fan horizontal orientation
*
* @param bridgeName - name of the bridge
* @param deviceId - ID of the LG Thinq Device
* @param currentSnap - Current data snapshot
* @param newStep - new horizontal position
* @throws LGThinqApiException - If some error invoking LG API.
*/
void changeStepLeftRight(String bridgeName, String deviceId, ACCanonicalSnapshot currentSnap, int newStep)
throws LGThinqApiException;
/**
* Change the target temperature
*
* @param bridgeName - name of the bridge
* @param deviceId - ID of the LG Thinq Device
* @param newTargetTemp - new target temperature
* @throws LGThinqApiException - If some error invoking LG API.
*/
void changeTargetTemperature(String bridgeName, String deviceId, ACTargetTmp newTargetTemp)
throws LGThinqApiException;
/**
* Turn On/Off the Jet Mode feature
*
* @param bridgeName - name of the bridge
* @param deviceId - ID of the LG Thinq Device
* @param modeOnOff - turn on/off
* @throws LGThinqApiException - If some error invoking LG API.
*/
void turnCoolJetMode(String bridgeName, String deviceId, String modeOnOff) throws LGThinqApiException;
/**
* Turn On/Off the Air Clean feature
*
* @param bridgeName - name of the bridge
* @param deviceId - ID of the LG Thinq Device
* @param modeOnOff - turn on/off
* @throws LGThinqApiException - If some error invoking LG API.
*/
void turnAirCleanMode(String bridgeName, String deviceId, String modeOnOff) throws LGThinqApiException;
/**
* Turn On/Off the Auto Dry feature
*
* @param bridgeName - name of the bridge
* @param deviceId - ID of the LG Thinq Device
* @param modeOnOff - turn on/off
* @throws LGThinqApiException - If some error invoking LG API.
*/
void turnAutoDryMode(String bridgeName, String deviceId, String modeOnOff) throws LGThinqApiException;
/**
* Turn On/Off the Energy Saving feature
*
* @param bridgeName - name of the bridge
* @param deviceId - ID of the LG Thinq Device
* @param modeOnOff - turn on/off
* @throws LGThinqApiException - If some error invoking LG API.
*/
void turnEnergySavingMode(String bridgeName, String deviceId, String modeOnOff) throws LGThinqApiException;
/**
* Get Extended Device Information (Energy consumption, filter level, etc).
*
* @param bridgeName Bridge name
* @param deviceId - ID of the LG Thinq Device
* @return ExtendedDeviceInfo containing the device extended data
* @throws LGThinqApiException - If some error invoking LG API.
*/
ExtendedDeviceInfo getExtendedDeviceInfo(String bridgeName, String deviceId) throws LGThinqApiException;
}

View File

@ -51,6 +51,7 @@ import org.openhab.binding.lgthinq.lgservices.api.RestResult;
import org.openhab.binding.lgthinq.lgservices.api.RestUtils;
import org.openhab.binding.lgthinq.lgservices.api.TokenManager;
import org.openhab.binding.lgthinq.lgservices.api.TokenResult;
import org.openhab.binding.lgthinq.lgservices.errors.LGThinqAccessException;
import org.openhab.binding.lgthinq.lgservices.errors.LGThinqApiException;
import org.openhab.binding.lgthinq.lgservices.errors.LGThinqDeviceV1MonitorExpiredException;
import org.openhab.binding.lgthinq.lgservices.errors.LGThinqDeviceV1OfflineException;
@ -75,7 +76,9 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
/**
* The {@link LGThinQACApiV1ClientServiceImpl}
* The {@link LGThinQAbstractApiClientService} - base class for all LG API client service. It's provide commons methods
* to
* communicate to the LG Cloud and exchange basic data.
*
* @author Nemer Daud - Initial contribution
*/
@ -174,6 +177,8 @@ public abstract class LGThinQAbstractApiClientService<C extends CapabilityDefini
token.getGatewayInfo().getCountry(), token.getAccessToken(), token.getUserInfo().getUserNumber());
RestResult resp = RestUtils.getCall(httpClient, builder.build().toURL().toString(), headers, null);
return handleDeviceSettingsResult(resp);
} catch (LGThinqException e) {
throw e;
} catch (Exception e) {
throw new LGThinqApiException("Errors list account devices from LG Server API", e);
}
@ -193,7 +198,8 @@ public abstract class LGThinQAbstractApiClientService<C extends CapabilityDefini
LGThinQAbstractApiClientService.logger.warn(
"Error calling device settings from LG Server API. HTTP Status: {}. The reason is: {}",
resp.getStatusCode(), ResultCodes.getReasonResponse(resp.getJsonResponse()));
return Collections.emptyMap();
throw new LGThinqAccessException(String.format("Error calling device settings from LG Server API. HTTP Status: %d. The reason is: %s",
resp.getStatusCode(), ResultCodes.getReasonResponse(resp.getJsonResponse())));
}
try {
respMap = objectMapper.readValue(resp.getJsonResponse(), new TypeReference<>() {

View File

@ -46,7 +46,8 @@ import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.node.ObjectNode;
/**
* The {@link LGThinQAbstractApiV1ClientService}
* The {@link LGThinQAbstractApiV1ClientService} - Specialized abstract class that implements methods and services to
* handle LG API V1 communication and convention.
*
* @author Nemer Daud - Initial contribution
*/

View File

@ -39,7 +39,8 @@ import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.node.ObjectNode;
/**
* The {@link LGThinQAbstractApiV2ClientService}
* The {@link LGThinQAbstractApiV2ClientService} - Specialized abstract class that implements methods and services to
* * handle LG API V2 communication and convention.
*
* @author Nemer Daud - Initial contribution
*/

View File

@ -30,15 +30,29 @@ import org.openhab.binding.lgthinq.lgservices.model.LGDevice;
import org.openhab.binding.lgthinq.lgservices.model.SnapshotDefinition;
/**
* The {@link LGThinQApiClientService}
* The {@link LGThinQApiClientService} - defines the basic methods to manage devices in the LG Cloud
*
* @author Nemer Daud - Initial contribution
*/
@NonNullByDefault
public interface LGThinQApiClientService<C extends CapabilityDefinition, S extends SnapshotDefinition> {
/**
* List all devices registers in the LG Account
*
* @param bridgeName bridge name
* @return return a List off all devices registered for the user account.
* @throws LGThinqApiException if some error occur accessing LG API
*/
List<LGDevice> listAccountDevices(String bridgeName) throws LGThinqApiException;
/**
* Get the LG device metadata about the settings and capabilities of the Device
*
* @param bridgeName bridge name
* @param deviceId LG Device ID
* @return A map containing all the device settings.
* @throws LGThinqApiException
*/
Map<String, Object> getDeviceSettings(String bridgeName, String deviceId) throws LGThinqApiException;
void initializeDevice(String bridgeName, String deviceId) throws LGThinqApiException;
@ -47,25 +61,88 @@ public interface LGThinQApiClientService<C extends CapabilityDefinition, S exten
* Retrieve actual data from device (its sensors and points states).
*
* @param deviceId device number
* @param capDef
* @return return snapshot state of the device
* @param capDef Capabilities definition/settings of the device
* @return return snapshot state of the device sensors and features
* @throws LGThinqApiException if some error interacting with LG API Server occur.
*/
@Nullable
S getDeviceData(String bridgeName, String deviceId, CapabilityDefinition capDef) throws LGThinqApiException;
/**
* Turn on/off the device
*
* @param bridgeName bridge name
* @param deviceId LG device ID
* @param newPowerState new Power State
* @throws LGThinqApiException if some error interacting with LG API Server occur.
*/
void turnDevicePower(String bridgeName, String deviceId, DevicePowerState newPowerState) throws LGThinqApiException;
/**
* Start the device Monitor responsible to open a window of data collection. (only used for V1 protocol)
*
* @param bridgeName bridge name
* @param deviceId LG device ID
* @return string with the monitor ID
* @throws LGThinqApiException if some error interacting with LG API Server occur.
* @throws IOException if some error occur opening device's configuration files.
*/
String startMonitor(String bridgeName, String deviceId) throws LGThinqApiException, IOException;
/**
* Get the capabilities of the device (got from device settings)
*
* @param deviceId The LG device ID
* @param uri the URL containing the XML descriptor of the device
* @param forceRecreate If you want to recreate the cached file of the XML descriptor
* @return the capability object related to the device
* @throws LGThinqApiException if some error interacting with LG API Server occur.
*/
C getCapability(String deviceId, String uri, boolean forceRecreate) throws LGThinqApiException;
/**
* Build a default snapshot data of the device when it's offline, junto to keep data integrity in the channels
*
* @return Default snapshot.
*/
S buildDefaultOfflineSnapshot();
/**
* Load device capabilities from the cached file.
*
* @param deviceId LG Thinq Device ID
* @param uri if the file doesn't exist, get the content from registered URI and save locally.
* @param forceRecreate force to recreate the file even if was previously saved locally
* @return File pointing to the capability file
* @throws LGThinqApiException if some error interacting with LG API Server occur.
*/
File loadDeviceCapability(String deviceId, String uri, boolean forceRecreate) throws LGThinqApiException;
/**
* Stop the monitor of data collection
*
* @param bridgeName Bridge name
* @param deviceId LG Device ID
* @param workId name of the monitor
* @throws LGThinqApiException if some error interacting with LG API Server occur.
* @throws IOException if some error occur opening device's configuration files.
*/
void stopMonitor(String bridgeName, String deviceId, String workId) throws LGThinqException, IOException;
/**
* Get data collected by the monitor
*
* @param bridgeName Bridge name
* @param deviceId LG Device ID
* @param workerId monitor ID
* @param deviceType Device Type related to the data collected
* @param deviceCapability capabilities of the device
* @return Snapshot of the device collected from LG API
* @throws LGThinqApiException if some error is returned from LG API
* @throws LGThinqDeviceV1MonitorExpiredException if the monitor is not valid anymore
* @throws IOException if some IO error happen when accessing token cache file.
* @throws LGThinqUnmarshallException if some error happen reading data collected from LG API
*/
@Nullable
S getMonitorData(String bridgeName, String deviceId, String workerId, DeviceTypes deviceType, C deviceCapability)
throws LGThinqApiException, LGThinqDeviceV1MonitorExpiredException, IOException, LGThinqUnmarshallException;

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.lgthinq.lgservices;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.binding.lgthinq.lgservices.errors.LGThinqApiException;
import org.openhab.binding.lgthinq.lgservices.model.devices.washerdryer.WasherDryerCapability;
import org.openhab.binding.lgthinq.lgservices.model.devices.washerdryer.WasherDryerSnapshot;
/**
* The {@link LGThinQDRApiClientService}
*
* @author Nemer Daud - Initial contribution
*/
@NonNullByDefault
public interface LGThinQDRApiClientService extends LGThinQApiClientService<WasherDryerCapability, WasherDryerSnapshot> {
void remoteStart(String bridgeName, String deviceId) throws LGThinqApiException;
void wakeUp(String bridgeName, String deviceId) throws LGThinqApiException;
}

View File

@ -1,71 +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.lgthinq.lgservices;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jetty.client.HttpClient;
import org.openhab.binding.lgthinq.lgservices.api.RestResult;
import org.openhab.binding.lgthinq.lgservices.errors.LGThinqApiException;
import org.openhab.binding.lgthinq.lgservices.model.DevicePowerState;
import org.openhab.binding.lgthinq.lgservices.model.devices.washerdryer.WasherDryerCapability;
import org.openhab.binding.lgthinq.lgservices.model.devices.washerdryer.WasherDryerSnapshot;
/**
* The {@link LGThinQDRApiV2ClientServiceImpl}
*
* @author Nemer Daud - Initial contribution
*/
@NonNullByDefault
public class LGThinQDRApiV2ClientServiceImpl
extends LGThinQAbstractApiV2ClientService<WasherDryerCapability, WasherDryerSnapshot>
implements LGThinQDRApiClientService {
protected LGThinQDRApiV2ClientServiceImpl(HttpClient httpClient) {
super(WasherDryerCapability.class, WasherDryerSnapshot.class, httpClient);
}
@Override
protected boolean beforeGetDataDevice(String bridgeName, String deviceId) {
// there's no before settings to send command
return false;
}
@Override
public void turnDevicePower(String bridgeName, String deviceId, DevicePowerState newPowerState) {
throw new UnsupportedOperationException("Not implemented yet.");
}
@Override
public void remoteStart(String bridgeName, String deviceId) throws LGThinqApiException {
try {
RestResult result = sendCommand(bridgeName, deviceId, "control-sync", "WMStart", "WMStart", "WMStart", "");
handleGenericErrorResult(result);
} catch (LGThinqApiException e) {
throw e;
} catch (Exception e) {
throw new LGThinqApiException("Error sending remote start", e);
}
}
@Override
public void wakeUp(String bridgeName, String deviceId) throws LGThinqApiException {
try {
RestResult result = sendCommand(bridgeName, deviceId, "control-sync", "WMWakeup", "WMWakeup", "", "");
handleGenericErrorResult(result);
} catch (LGThinqApiException e) {
throw e;
} catch (Exception e) {
throw new LGThinqApiException("Error sending remote start", e);
}
}
}

View File

@ -19,14 +19,20 @@ import org.openhab.binding.lgthinq.lgservices.model.devices.dishwasher.DishWashe
import org.openhab.binding.lgthinq.lgservices.model.devices.dishwasher.DishWasherSnapshot;
/**
* The {@link LGThinQDishWasherApiClientService}
* The {@link LGThinQDishWasherApiClientService} - implements specific methods for DishWashers
*
* @author Nemer Daud - Initial contribution
*/
@NonNullByDefault
public interface LGThinQDishWasherApiClientService
extends LGThinQApiClientService<DishWasherCapability, DishWasherSnapshot> {
/**
* Remote start machine funcion
*
* @param bridgeName Bridge name
* @param cap Capabilities of the device
* @param deviceId LG Device ID
* @param data data to sent to remote start
*/
void remoteStart(String bridgeName, DishWasherCapability cap, String deviceId, Map<String, Object> data);
void wakeUp(String bridgeName, String deviceId, Boolean wakeUp);
}

View File

@ -57,9 +57,4 @@ public class LGThinQDishWasherApiV1ClientServiceImpl
public void remoteStart(String bridgeName, DishWasherCapability cap, String deviceId, Map<String, Object> data) {
throw new UnsupportedOperationException("Not implemented yet");
}
@Override
public void wakeUp(String bridgeName, String deviceId, Boolean wakeUp) {
throw new UnsupportedOperationException("Not implemented yet");
}
}

View File

@ -49,9 +49,4 @@ public class LGThinQDishWasherApiV2ClientServiceImpl
public void remoteStart(String bridgeName, DishWasherCapability cap, String deviceId, Map<String, Object> data) {
throw new UnsupportedOperationException("Not implemented yet");
}
@Override
public void wakeUp(String bridgeName, String deviceId, Boolean wakeUp) {
throw new UnsupportedOperationException("Not implemented yet");
}
}

View File

@ -21,27 +21,82 @@ import org.openhab.binding.lgthinq.lgservices.model.devices.fridge.FridgeCanonic
import org.openhab.binding.lgthinq.lgservices.model.devices.fridge.FridgeCapability;
/**
* The {@link LGThinQFridgeApiClientService}
* The {@link LGThinQFridgeApiClientService} - Interface with specific methods for Fridge Devices
*
* @author Nemer Daud - Initial contribution
*/
@NonNullByDefault
public interface LGThinQFridgeApiClientService
extends LGThinQApiClientService<FridgeCapability, FridgeCanonicalSnapshot> {
/**
* Set fridge temperature
*
* @param bridgeId Bridge ID
* @param deviceId LG Device ID
* @param fridgeCapability Fridge Capabilities
* @param targetTemperatureIndex target temperature
* @param tempUnit Temperature Unit
* @param snapCmdData Snapshot template for the target temperature command
* @throws LGThinqApiException If some error is reported from LG API
*/
void setFridgeTemperature(String bridgeId, String deviceId, FridgeCapability fridgeCapability,
Integer targetTemperatureIndex, String tempUnit, @Nullable Map<String, Object> snapCmdData)
throws LGThinqApiException;
/**
* Set fridge temperature
*
* @param bridgeId Bridge ID
* @param deviceId LG Device ID
* @param fridgeCapability Fridge Capabilities
* @param targetTemperatureIndex target temperature
* @param tempUnit Temperature Unit
* @param snapCmdData Snapshot template for the target temperature command
* @throws LGThinqApiException If some error is reported from LG API
*/
void setFreezerTemperature(String bridgeId, String deviceId, FridgeCapability fridgeCapability,
Integer targetTemperatureIndex, String tempUnit, @Nullable Map<String, Object> snapCmdData)
throws LGThinqApiException;
/**
* Setup Express Mode
*
* @param bridgeId Bridge ID
* @param deviceId LG Device ID
* @param expressModeIndex Empress mode desired
* @throws LGThinqApiException If some error is reported from LG API
*/
void setExpressMode(String bridgeId, String deviceId, String expressModeIndex) throws LGThinqApiException;
/**
* Set the Express Cool Mode
*
* @param bridgeId Bridge ID
* @param deviceId LG Device id
* @param trueOnFalseOff ON/OFF the Cool Mode
* @throws LGThinqApiException If some error is reported from LG API
*/
void setExpressCoolMode(String bridgeId, String deviceId, boolean trueOnFalseOff) throws LGThinqApiException;
/**
* Set the Express Cool Mode
*
* @param bridgeId Bridge ID
* @param deviceId LG Device id
* @param trueOnFalseOff ON/OFF the Eco Mode
* @throws LGThinqApiException If some error is reported from LG API
*/
void setEcoFriendlyMode(String bridgeId, String deviceId, boolean trueOnFalseOff) throws LGThinqApiException;
/**
*
* @param bridgeId Bridge ID
* @param deviceId LG Thinq Device ID
* @param fridgeCapability Fridge Capabilities
* @param trueOnFalseOff Set ON/OFF the ICE Plus
* @param snapCmdData Snapshot template for the ICE Plus Command
* @throws LGThinqApiException If some error is reported from LG API
*/
void setIcePlus(String bridgeId, String deviceId, FridgeCapability fridgeCapability, boolean trueOnFalseOff,
Map<String, Object> snapCmdData) throws LGThinqApiException;
}

View File

@ -20,14 +20,31 @@ import org.openhab.binding.lgthinq.lgservices.model.devices.washerdryer.WasherDr
import org.openhab.binding.lgthinq.lgservices.model.devices.washerdryer.WasherDryerSnapshot;
/**
* The {@link LGThinQWMApiClientService}
* The {@link LGThinQWMApiClientService} - Methods specifics for Washing/Drier Machines
*
* @author Nemer Daud - Initial contribution
*/
@NonNullByDefault
public interface LGThinQWMApiClientService extends LGThinQApiClientService<WasherDryerCapability, WasherDryerSnapshot> {
/**
* Control the remote start feature
*
* @param bridgeName Bridge Name
* @param cap Capabilities of the device
* @param deviceId LG Device ID
* @param data Data to control the remote start
* @throws LGThinqApiException if some error is reported from the LG API
*/
void remoteStart(String bridgeName, WasherDryerCapability cap, String deviceId, Map<String, Object> data)
throws LGThinqApiException;
/**
* Waking UP feature
*
* @param bridgeName Bridge Name
* @param deviceId LG Device Name
* @param wakeUp to Wake Up (true/false)
* @throws LGThinqApiException if some error is reported from the LG API
*/
void wakeUp(String bridgeName, String deviceId, Boolean wakeUp) throws LGThinqApiException;
}

View File

@ -23,7 +23,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
/**
* The {@link LGThinqCanonicalModelUtil} class
* The {@link LGThinqCanonicalModelUtil} class - Utilities to help communication with LG API
*
* @author Nemer Daud - Initial contribution
*/
@ -31,13 +31,20 @@ import com.fasterxml.jackson.databind.ObjectMapper;
public class LGThinqCanonicalModelUtil {
public static final ObjectMapper mapper = new ObjectMapper();
/**
* Get structured result from the LG Authentication Gateway
*
* @param rawJson RAW Json to process
* @return Structured Object returned from the API
* @throws IOException If some error happen procession token from file.
*/
public static GatewayResult getGatewayResult(String rawJson) throws IOException {
Map<String, Object> map = mapper.readValue(rawJson, new TypeReference<>() {
});
Map<String, String> content = mapper.convertValue(map, new TypeReference<>() {
});
@SuppressWarnings("unchecked")
Map<String, String> content = (Map<String, String>) map.get("result");
String resultCode = (String) map.get("resultCode");
if (content == null) {
if (content == null || content.isEmpty()) {
throw new IllegalArgumentException("Unexpected result. Gateway Content Result is null");
} else if (resultCode == null) {
throw new IllegalArgumentException("Unexpected result. resultCode code is null");

View File

@ -24,7 +24,7 @@ import org.openhab.binding.lgthinq.lgservices.api.model.GatewayResult;
import com.fasterxml.jackson.annotation.JsonIgnore;
/**
* The {@link LGThinqGateway} hold informations about the LG Gateway
* The {@link LGThinqGateway} hold information about the LG Gateway
*
* @author Nemer Daud - Initial contribution
*/

View File

@ -114,7 +114,8 @@ public class LGThinqOauthEmpAuthenticator {
if (result.getStatusCode() != 200) {
throw new IllegalStateException(
"Expected HTTP OK return, but received result core:" + result.getJsonResponse());
String.format("Expected HTTP OK return, but received result core:[%s] - error message:[%s]",
result.getJsonResponse(), ResultCodes.getReasonResponse(result.getJsonResponse())));
} else {
GatewayResult gwResult = LGThinqCanonicalModelUtil.getGatewayResult(result.getJsonResponse());
ResultCodes resultCode = ResultCodes.fromCode(gwResult.getReturnedCode());
@ -176,9 +177,8 @@ public class LGThinqOauthEmpAuthenticator {
}
Map<String, Object> loginResult = objectMapper.readValue(resp.getJsonResponse(), new TypeReference<>() {
});
Map<String, String> accountResult = objectMapper.convertValue(loginResult.get("account"),
new TypeReference<>() {
});
@SuppressWarnings("unchecked")
Map<String, String> accountResult = (Map<String, String>) loginResult.get("account");
if (accountResult == null) {
throw new IllegalStateException("Error getting account from Login");
}
@ -277,8 +277,8 @@ public class LGThinqOauthEmpAuthenticator {
|| ((Map<?, ?>) result.getOrDefault("account", Collections.emptyMap())).get("userNo") == null) {
throw new IllegalStateException("Error retrieving the account user information from access token");
}
Map<String, String> accountInfo = objectMapper.convertValue(result.get("account"), new TypeReference<>() {
});
@SuppressWarnings("unchecked")
Map<String, String> accountInfo = (Map<String, String>) result.getOrDefault("account", Collections.emptyMap());
return new UserInfo(
Objects.requireNonNullElse(accountInfo.get("userNo"),

View File

@ -0,0 +1,21 @@
package org.openhab.binding.lgthinq.lgservices.errors;
import org.openhab.binding.lgthinq.lgservices.model.ResultCodes;
public class LGThinqAccessException extends LGThinqApiException {
public LGThinqAccessException(String message, Throwable cause) {
super(message, cause);
}
public LGThinqAccessException(String message, Throwable cause, ResultCodes reasonCode) {
super(message, cause, reasonCode);
}
public LGThinqAccessException(String message) {
super(message);
}
public LGThinqAccessException(String message, ResultCodes resultCode) {
super(message, resultCode);
}
}

View File

@ -27,7 +27,7 @@ public enum DeviceTypes {
WASHER_TOWER(221, "WM", "", "washer-tower-221"),
DRYER(202, "DR", "Dryer", "dryer-202"),
DRYER_TOWER(222, "DR", "Dryer", "dryer-tower-222"),
REFRIGERATOR(101, "REF", "Fridge", "fridge-101"),
FRIDGE(101, "REF", "Fridge", "fridge-101"),
DISH_WASHER(204, "DW", "DishWasher", "dishwasher-204"),
UNKNOWN(-1, "", "", "");
@ -70,7 +70,7 @@ public enum DeviceTypes {
case 222:
return DRYER_TOWER;
case 101:
return REFRIGERATOR;
return FRIDGE;
default:
return UNKNOWN;
}
@ -90,7 +90,7 @@ public enum DeviceTypes {
}
yield WASHERDRYER_MACHINE;
}
case "REF" -> REFRIGERATOR;
case "REF" -> FRIDGE;
case "DW" -> DISH_WASHER;
default -> UNKNOWN;
};

View File

@ -72,7 +72,7 @@ public class ModelUtils {
case WASHERDRYER_MACHINE:
case DRYER:
case REFRIGERATOR:
case FRIDGE:
if (rootMap.containsKey("Value")) {
return LGAPIVerion.V1_0;
} else if (rootMap.containsKey("MonitoringValue")) {

View File

@ -102,93 +102,43 @@ public enum ResultCodes {
}
public static ResultCodes fromCode(String code) {
switch (code) {
case "0000":
case "0001":
return OK;
case "0002":
return INVALID_PAYLOAD;
case "0003":
return INVALID_HEAD;
case "0110": // Update Terms
return UPDATE_TERMS_NEEDED;
case "0004": // Duplicated Login
return LOGIN_DUPLICATED;
case "0102": // Not Logged in
case "0114": // Mismatch Login Session
return LOGIN_FAILED;
case "0100":
return GENERAL_FAILURE;
case "0116":
return INVALID_REQUEST;
case "0108":
case "0109":
return NO_INFORMATION_FOUND;
case "0115":
case "0006":
case "0009":
case "0117":
case "0014":
case "0101":
return DEVICE_MISMATCH;
case "0010":
return INVALID_CUSTOMER_DATA;
case "0112":
return LIMIT_EXCEEDED_ERROR;
case "0118":
case "0120":
return INVALID_CUSTOMER_NUMBER;
case "0121":
return NOT_REGISTERED_SMART_CARE;
case "0007":
return PORTAL_INTERWORKING_ERROR;
case "0008":
case "0013":
return DUPLICATED_DATA;
case "0005":
case "0012":
case "8001":
return NOT_SUPPORTED_CONTROL;
case "0111":
case "0103":
case "0104":
case "0106":
return DEVICE_NOT_RESPONSE;
case "0105":
return CONTROL_ERROR;
case "9001":
case "9002":
return BASE64_CODING_ERROR;
case "0107":
case "8101":
case "8102":
case "8203":
case "8204":
case "8205":
case "8206":
case "8207":
case "8900":
case "9000":
case "9003":
case "9004":
case "9005":
return LG_SERVER_ERROR;
case "9999":
return PAYLOAD_ERROR;
case "9006":
case "0011":
case "0113":
return ACCESS_DENIED;
case "9010":
return INVALID_CSR;
case "0301":
return INVALID_PUSH_TOKEN;
default:
return switch (code) {
case "0000", "0001" -> OK;
case "0002" -> INVALID_PAYLOAD;
case "0003" -> INVALID_HEAD;
case "0110" -> // Update Terms
UPDATE_TERMS_NEEDED;
case "0004" -> // Duplicated Login
LOGIN_DUPLICATED; // Not Logged in
case "0102", "0114" -> // Mismatch Login Session
LOGIN_FAILED;
case "0100" -> GENERAL_FAILURE;
case "0116" -> INVALID_REQUEST;
case "0108", "0109" -> NO_INFORMATION_FOUND;
case "0115", "0006", "0009", "0117", "0014", "0101" -> DEVICE_MISMATCH;
case "0010" -> INVALID_CUSTOMER_DATA;
case "0112" -> LIMIT_EXCEEDED_ERROR;
case "0118", "0120" -> INVALID_CUSTOMER_NUMBER;
case "0121" -> NOT_REGISTERED_SMART_CARE;
case "0007" -> PORTAL_INTERWORKING_ERROR;
case "0008", "0013" -> DUPLICATED_DATA;
case "0005", "0012", "8001" -> NOT_SUPPORTED_CONTROL;
case "0111", "0103", "0104", "0106" -> DEVICE_NOT_RESPONSE;
case "0105" -> CONTROL_ERROR;
case "9001", "9002" -> BASE64_CODING_ERROR;
case "0107", "8101", "8102", "8203", "8204", "8205", "8206", "8207", "8900", "9000", "9003", "9004",
"9005" ->
LG_SERVER_ERROR;
case "9999" -> PAYLOAD_ERROR;
case "9006", "0011", "0113" -> ACCESS_DENIED;
case "9010" -> INVALID_CSR;
case "0301" -> INVALID_PUSH_TOKEN;
default -> {
if (OTHER_ERROR_CODE_RESPONSE.containsKey(code)) {
return OTHER;
yield OTHER;
}
return UNKNOWN;
}
yield UNKNOWN;
}
};
}
}

View File

@ -141,7 +141,7 @@ public abstract class AbstractFridgeCapabilityFactory extends AbstractCapability
@Override
protected List<DeviceTypes> getSupportedDeviceTypes() {
return List.of(DeviceTypes.REFRIGERATOR);
return List.of(DeviceTypes.FRIDGE);
}
protected abstract String getMonitorValueNodeName();

View File

@ -129,8 +129,7 @@ public class FridgeCapabilityFactoryV2 extends AbstractFridgeCapabilityFactory {
}
protected String getFridgeTempNodeName() {
throw new UnsupportedOperationException(
"Refrigerator Thinq2 doesn't support FridgeTemp node. It most likely a bug");
throw new UnsupportedOperationException("Fridge Thinq2 doesn't support FridgeTemp node. It most likely a bug");
}
@Override
@ -145,8 +144,7 @@ public class FridgeCapabilityFactoryV2 extends AbstractFridgeCapabilityFactory {
@Override
protected String getFreezerTempNodeName() {
throw new UnsupportedOperationException(
"Refrigerator Thinq2 doesn't support FreezerTemp node. It most likely a bug");
throw new UnsupportedOperationException("Fridge Thinq2 doesn't support FreezerTemp node. It most likely a bug");
}
@Override

View File

@ -13,7 +13,7 @@
package org.openhab.binding.lgthinq.lgservices.model.devices.fridge;
import static org.openhab.binding.lgthinq.lgservices.LGServicesConstants.RE_SNAPSHOT_NODE_V2;
import static org.openhab.binding.lgthinq.lgservices.model.DeviceTypes.REFRIGERATOR;
import static org.openhab.binding.lgthinq.lgservices.model.DeviceTypes.FRIDGE;
import java.util.List;
import java.util.Map;
@ -48,7 +48,7 @@ public class FridgeSnapshotBuilder extends DefaultSnapshotBuilder<FridgeCanonica
@Override
protected FridgeCanonicalSnapshot getSnapshot(Map<String, Object> snapMap, CapabilityDefinition capDef) {
FridgeCanonicalSnapshot snap;
if (REFRIGERATOR.equals(capDef.getDeviceType())) {
if (FRIDGE.equals(capDef.getDeviceType())) {
switch (capDef.getDeviceVersion()) {
case V1_0:
throw new IllegalArgumentException("Version 1.0 for Fridge driver is not supported yet.");

View File

@ -12,12 +12,12 @@
*/
package org.openhab.binding.lgthinq.lgservices.model.devices.washerdryer;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_WMD_REMOTE_START_RINSE;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_WMD_REMOTE_START_SPIN;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_WMD_REMOTE_START_TEMP;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_WMD_RINSE_ID;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_WMD_SPIN_ID;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_WMD_TEMP_LEVEL_ID;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_WM_REMOTE_START_RINSE;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_WM_REMOTE_START_SPIN;
import static org.openhab.binding.lgthinq.internal.LGThinQBindingConstants.CHANNEL_WM_REMOTE_START_TEMP;
import static org.openhab.binding.lgthinq.lgservices.LGServicesConstants.WM_LOST_WASHING_STATE_KEY;
import static org.openhab.binding.lgthinq.lgservices.LGServicesConstants.WM_LOST_WASHING_STATE_VALUE;
@ -97,11 +97,11 @@ public abstract class AbstractWasherDryerCapabilityFactory extends AbstractCapab
wdCap.setProcessState(newFeatureDefinition(getProcessStateNodeName(), monitorValueNode));
// --- Selectable features -----
wdCap.setRinseFeat(newFeatureDefinition(getRinseFeatureNodeName(), monitorValueNode,
CHANNEL_WM_REMOTE_START_RINSE, CHANNEL_WMD_RINSE_ID));
CHANNEL_WMD_REMOTE_START_RINSE, CHANNEL_WMD_RINSE_ID));
wdCap.setTemperatureFeat(newFeatureDefinition(getTemperatureFeatureNodeName(), monitorValueNode,
CHANNEL_WM_REMOTE_START_TEMP, CHANNEL_WMD_TEMP_LEVEL_ID));
wdCap.setSpinFeat(newFeatureDefinition(getSpinFeatureNodeName(), monitorValueNode, CHANNEL_WM_REMOTE_START_SPIN,
CHANNEL_WMD_SPIN_ID));
CHANNEL_WMD_REMOTE_START_TEMP, CHANNEL_WMD_TEMP_LEVEL_ID));
wdCap.setSpinFeat(newFeatureDefinition(getSpinFeatureNodeName(), monitorValueNode,
CHANNEL_WMD_REMOTE_START_SPIN, CHANNEL_WMD_SPIN_ID));
// ----------------------------
wdCap.setDryLevel(newFeatureDefinition(getDryLevelNodeName(), monitorValueNode));
wdCap.setSoilWash(newFeatureDefinition(getSoilWashFeatureNodeName(), monitorValueNode));

View File

@ -271,3 +271,7 @@ channel-type.lgthinq.washerdryer-temp-level.description = Target Temperature Lev
error.lgapi-getting-devices = Error getting device list from the account
error.toke-file-corrupted = LGThinq Bridge Token File corrupted
error.toke-refresh = Error refreshing LGThinq Bridge Token
error.toke-file-access-error = Error reading token file.
error.lgapi-communication-error = Communication Error with LG API
error.mandotory-fields-missing = Mandatory Fields Configuration Missing
offline.device-disconnected = Device is Offline

View File

@ -333,7 +333,7 @@
</channel-type>
<!-- Fridge -->
<channel-type id="fridge-some-door-open">
<channel-type id="fr-some-door-open">
<item-type>Contact</item-type>
<label>Door Open</label>
<description>Door status (at least one if combined fridge/freezer)</description>
@ -344,7 +344,7 @@
</options>
</state>
</channel-type>
<channel-type id="fridge-temp-unit">
<channel-type id="fr-temp-unit">
<item-type>String</item-type>
<label>Temp. Unit</label>
<description>Temperature Unit</description>
@ -356,20 +356,20 @@
</state>
</channel-type>
<channel-type id="fridge-freezer-temperature">
<channel-type id="fr-freezer-temperature">
<item-type>Number:Temperature</item-type>
<label>Freezer Temp.</label>
<description>Freezer setpoint temperature</description>
<category>Temperature</category>
<state readOnly="true" pattern="%.1f %unit%"/>
<state pattern="%.1f %unit%"/>
</channel-type>
<channel-type id="fridge-fridge-temperature">
<channel-type id="fr-fridge-temperature">
<item-type>Number:Temperature</item-type>
<label>Fridge Setpoint Temperature</label>
<description>Fridge setpoint temperature.</description>
<category>Temperature</category>
<state readOnly="true" pattern="%.1f %unit%"/>
<state pattern="%.1f %unit%"/>
</channel-type>
<channel-type id="fr-express-mode">

View File

@ -23,10 +23,10 @@
<label>Dashboard</label>
<description>This is the Displayed Information.</description>
<channels>
<channel id="some-door-open" typeId="fridge-some-door-open"/>
<channel id="freezer-temperature" typeId="fridge-freezer-temperature"/>
<channel id="fridge-temperature" typeId="fridge-fridge-temperature"/>
<channel id="temp-unit" typeId="fridge-temp-unit"/>
<channel id="fr-some-door-open" typeId="fr-some-door-open"/>
<channel id="fr-freezer-temperature" typeId="fr-freezer-temperature"/>
<channel id="fr-fridge-temperature" typeId="fr-fridge-temperature"/>
<channel id="fr-temp-unit" typeId="fr-temp-unit"/>
</channels>
</channel-group-type>
<channel-group-type id="fr-extended-information">