From 40202b1641085d6fe789f8dc3b293df6524d01d5 Mon Sep 17 00:00:00 2001 From: Laurent ARNAL Date: Wed, 8 Jan 2025 12:20:01 +0100 Subject: [PATCH] fixes for Jacob review Signed-off-by: Laurent ARNAL --- .../binding/linky/internal/handler/LinkyHandler.java | 6 +++--- .../src/main/resources/OH-INF/i18n/linky.properties | 4 +++- .../src/main/resources/OH-INF/thing/thing-types.xml | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/bundles/org.openhab.binding.linky/src/main/java/org/openhab/binding/linky/internal/handler/LinkyHandler.java b/bundles/org.openhab.binding.linky/src/main/java/org/openhab/binding/linky/internal/handler/LinkyHandler.java index 193c0ccc4a5..3775a6c5d8e 100644 --- a/bundles/org.openhab.binding.linky/src/main/java/org/openhab/binding/linky/internal/handler/LinkyHandler.java +++ b/bundles/org.openhab.binding.linky/src/main/java/org/openhab/binding/linky/internal/handler/LinkyHandler.java @@ -161,12 +161,12 @@ public class LinkyHandler extends BaseThingHandler { // update the timezone if not set to default to openhab default timezone Configuration thingConfig = getConfig(); - Object val = thingConfig.get("timezone"); - if (val == null || "".equals(val)) { + String val = (String) thingConfig.get("timezone"); + if (val == null || val.isBlank()) { zoneId = this.timeZoneProvider.getTimeZone(); thingConfig.put("timezone", zoneId.getId()); } else { - zoneId = ZoneId.of((String) val); + zoneId = ZoneId.of(val); } updateConfiguration(thingConfig); diff --git a/bundles/org.openhab.binding.linky/src/main/resources/OH-INF/i18n/linky.properties b/bundles/org.openhab.binding.linky/src/main/resources/OH-INF/i18n/linky.properties index 9eeaf4460fd..ecf55352b3a 100644 --- a/bundles/org.openhab.binding.linky/src/main/resources/OH-INF/i18n/linky.properties +++ b/bundles/org.openhab.binding.linky/src/main/resources/OH-INF/i18n/linky.properties @@ -14,6 +14,8 @@ thing-type.config.linky.linky.internalAuthId.label = Auth ID thing-type.config.linky.linky.internalAuthId.description = Authentication ID delivered after the captcha (see documentation). thing-type.config.linky.linky.password.label = Password thing-type.config.linky.linky.password.description = Your Enedis Password +thing-type.config.linky.linky.timezone.label = timezone +thing-type.config.linky.linky.timezone.description = The timezone associated with your Point of delivery. Will default to openHAB default timezone. You will need to change this if your Linky is located in a different timezone that your openHAB location. You can use an offset, or a label like Europe/Paris thing-type.config.linky.linky.username.label = Username thing-type.config.linky.linky.username.description = Your Enedis Username @@ -41,6 +43,6 @@ channel-type.linky.power.label = Yesterday Peak Power channel-type.linky.power.description = Maximum power usage yesterday channel-type.linky.timestamp.label = Timestamp -# Thing status descriptions +# thing status descriptions offline.config-error-mandatory-settings = Username, password and authId are mandatory. diff --git a/bundles/org.openhab.binding.linky/src/main/resources/OH-INF/thing/thing-types.xml b/bundles/org.openhab.binding.linky/src/main/resources/OH-INF/thing/thing-types.xml index 8a66799dbcc..51a489096c7 100644 --- a/bundles/org.openhab.binding.linky/src/main/resources/OH-INF/thing/thing-types.xml +++ b/bundles/org.openhab.binding.linky/src/main/resources/OH-INF/thing/thing-types.xml @@ -37,9 +37,9 @@ The timezone associated with your Point of delivery. - Will default to openhab default timezone. + Will default to openHAB default timezone. You will - need to change this if your linky is located in a different timezone that your openhab location. + need to change this if your Linky is located in a different timezone that your openHAB location. You can use an offset, or a label like Europe/Paris