diff --git a/build.gradle b/build.gradle
index 2239c383..5f07163e 100644
--- a/build.gradle
+++ b/build.gradle
@@ -3,30 +3,6 @@ plugins {
id 'application'
}
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2025 Ziver Koc
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
// ------------------------------------
// Hal common configuration
// ------------------------------------
@@ -86,7 +62,7 @@ distributions {
from 'hal.conf.example'
from 'logging.properties'
- from sourceSets.main.output.resourcesDir
+ from "${buildDir}/resources"
}
}
}
@@ -100,12 +76,11 @@ task copyRecources(type: Copy) {
from "${subProject.projectDir}/resources"
}
- into(sourceSets.main.output.resourcesDir)
+ into("${buildDir}/resources")
}
-jar.dependsOn(copyRecources)
-copyRecources.mustRunAfter(processResources)
+processResources.finalizedBy(copyRecources)
application {
mainClass = 'se.hal.HalServer'
-}
+}
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index a5952066..622ab64a 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/hal-core/resources/web/event_config.tmpl b/hal-core/resources/web/event_config.tmpl
index 3f5ab5b4..e01b5a1a 100644
--- a/hal-core/resources/web/event_config.tmpl
+++ b/hal-core/resources/web/event_config.tmpl
@@ -1,27 +1,3 @@
-
-
@@ -47,7 +23,7 @@
{{#localEvents}}
| {{.getId()}} |
- {{.getName()}} |
+ {{.getName()}} |
{{.getType()}} |
{{.getDeviceConfig()}} |
diff --git a/hal-core/resources/web/js/vue/App.js b/hal-core/resources/web/js/vue/components/App.js
similarity index 100%
rename from hal-core/resources/web/js/vue/App.js
rename to hal-core/resources/web/js/vue/components/App.js
diff --git a/hal-core/resources/web/js/vue/components/EventTableRowComponent.js b/hal-core/resources/web/js/vue/components/EventTableRowComponent.js
index 743da530..0d7afc24 100644
--- a/hal-core/resources/web/js/vue/components/EventTableRowComponent.js
+++ b/hal-core/resources/web/js/vue/components/EventTableRowComponent.js
@@ -17,7 +17,7 @@ export default {
},
template: `
|
- | {{ event.name }} |
+ {{ event.name }} |
{{ event.configType }} |
{{ event.data?.valueStr }} |
{{ timestamp }} |
diff --git a/hal-core/resources/web/js/vue/lib/vue-router.esm-browser.js b/hal-core/resources/web/js/vue/vue-router.esm-browser.js
similarity index 100%
rename from hal-core/resources/web/js/vue/lib/vue-router.esm-browser.js
rename to hal-core/resources/web/js/vue/vue-router.esm-browser.js
diff --git a/hal-core/resources/web/js/vue/lib/vue-router.esm-browser.prod.js b/hal-core/resources/web/js/vue/vue-router.esm-browser.prod.js
similarity index 100%
rename from hal-core/resources/web/js/vue/lib/vue-router.esm-browser.prod.js
rename to hal-core/resources/web/js/vue/vue-router.esm-browser.prod.js
diff --git a/hal-core/resources/web/js/vue/lib/vue.esm-browser.js b/hal-core/resources/web/js/vue/vue.esm-browser.js
similarity index 100%
rename from hal-core/resources/web/js/vue/lib/vue.esm-browser.js
rename to hal-core/resources/web/js/vue/vue.esm-browser.js
diff --git a/hal-core/resources/web/js/vue/lib/vue.esm-browser.prod.js b/hal-core/resources/web/js/vue/vue.esm-browser.prod.js
similarity index 100%
rename from hal-core/resources/web/js/vue/lib/vue.esm-browser.prod.js
rename to hal-core/resources/web/js/vue/vue.esm-browser.prod.js
diff --git a/hal-core/resources/web/main_index.tmpl b/hal-core/resources/web/main_index.tmpl
index f2678740..34b6eb2b 100644
--- a/hal-core/resources/web/main_index.tmpl
+++ b/hal-core/resources/web/main_index.tmpl
@@ -1,27 +1,3 @@
-
-
@@ -77,14 +53,14 @@
diff --git a/hal-core/resources/web/sensor_config.tmpl b/hal-core/resources/web/sensor_config.tmpl
index 53891511..9af51b40 100644
--- a/hal-core/resources/web/sensor_config.tmpl
+++ b/hal-core/resources/web/sensor_config.tmpl
@@ -1,27 +1,3 @@
-
-
@@ -47,7 +23,7 @@
{{#localSensors}}
| {{.getId()}} |
- {{.getName()}} |
+ {{.getName()}} |
{{.getType()}} |
{{.isSynced()}} |
{{.getDeviceConfig()}} |
diff --git a/hal-core/src/se/hal/intf/HalAbstractControllerManager.java b/hal-core/src/se/hal/intf/HalAbstractControllerManager.java
index 1a0201ed..34076a54 100644
--- a/hal-core/src/se/hal/intf/HalAbstractControllerManager.java
+++ b/hal-core/src/se/hal/intf/HalAbstractControllerManager.java
@@ -1,27 +1,3 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2025 Ziver Koc
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
package se.hal.intf;
import zutil.ClassUtil;
@@ -67,7 +43,7 @@ public abstract class HalAbstractControllerManager> it = pluginManager.getClassIterator(HalAutostartController.class); it.hasNext(); ) {
Class controller = it.next();
diff --git a/hal-core/src/se/hal/page/JavascriptModules.java b/hal-core/src/se/hal/page/JavascriptModules.java
index 86b8153b..cd69c9ca 100644
--- a/hal-core/src/se/hal/page/JavascriptModules.java
+++ b/hal-core/src/se/hal/page/JavascriptModules.java
@@ -1,27 +1,3 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2025 Ziver Koc
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
package se.hal.page;
import se.hal.intf.HalJavascriptModule;
@@ -31,7 +7,7 @@ public class JavascriptModules implements HalJavascriptModule {
@Override
public HalJsModule[] getJavascriptModules() {
- HalWebPage.getRootNav().createSubNav("Events").createSubNav("events", "Overview");
+ HalWebPage.getRootNav().createSubNav("Events").createSubNav("event_overview", "Overview");
return new HalJsModule[] {
new HalJsModule("AlertStore", "./js/vue/stores/AlertStore.js"),
@@ -43,7 +19,7 @@ public class JavascriptModules implements HalJavascriptModule {
new HalJsModule("EventActionComponent", "./js/vue/components/EventActionComponent.js"),
new HalJsModulePage("EventDetailPageComponent", "./js/vue/components/EventDetailPageComponent.js", "/event/:id"),
- new HalJsModulePage("EventOverviewPageComponent", "./js/vue/components/EventOverviewPageComponent.js", "/events"),
+ new HalJsModulePage("EventOverviewPageComponent", "./js/vue/components/EventOverviewPageComponent.js", "/event_overview"),
new HalJsModule("EventTableComponent", "./js/vue/components/EventTableComponent.js"),
new HalJsModule("EventTableRowComponent", "./js/vue/components/EventTableRowComponent.js"),
};
diff --git a/hal.conf.example b/hal.conf.example
index 3982e717..977961ba 100644
--- a/hal.conf.example
+++ b/hal.conf.example
@@ -36,10 +36,6 @@ hal_core.http_port=8080
## Tibber Plugin
#hal_tibber.token=
-## EcoSense plugin
-#hal_vendor_ecosense.username=
-#hal_vendor_ecosense.password=
-
## Zigbee plugin
#hal_zigbee.com_port=COM4
#hal_zigbee.dongle=CC2531|CONBEE|XBEE
diff --git a/plugins/hal-vendor-ecosense/src/se/hal/plugin/vendor/ecosense/EcoSenseCloudAPIClient.java b/plugins/hal-vendor-ecosense/src/se/hal/plugin/vendor/ecosense/EcoSenseCloudAPIClient.java
index c0aaa34b..7c9f85ea 100644
--- a/plugins/hal-vendor-ecosense/src/se/hal/plugin/vendor/ecosense/EcoSenseCloudAPIClient.java
+++ b/plugins/hal-vendor-ecosense/src/se/hal/plugin/vendor/ecosense/EcoSenseCloudAPIClient.java
@@ -40,11 +40,8 @@ import zutil.parser.json.JSONWriter;
import java.io.IOException;
import java.net.MalformedURLException;
-import java.time.LocalDateTime;
-import java.time.ZoneOffset;
-import java.util.ArrayList;
+import java.text.SimpleDateFormat;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -62,6 +59,8 @@ public class EcoSenseCloudAPIClient {
private static final String USER_POOL_REGION = "us-west-2";
private static final String API_URL = "https://api.cloud.ecosense.io/api";
+ private static SimpleDateFormat DATE_PARSER = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX"); //2025-10-22T14:09:29.691533
+
private String username;
private String password;
/** The authenticated Amazon Cognito ID token. */
@@ -93,9 +92,7 @@ public class EcoSenseCloudAPIClient {
cognitoClient.close();
}
- public List getDevices() {
- List devices = new ArrayList<>();
-
+ public EcoSenseDevice getDevices() {
try {
if (ObjectUtil.isEmpty(idToken)) {
authenticate();
@@ -150,13 +147,13 @@ public class EcoSenseCloudAPIClient {
ecoSenseDevice.wifiName = deviceNode.getString("wifi_name");
try {
- ecoSenseDevice.lastRadonUpdateTime = LocalDateTime.parse(deviceNode.getString("last_radon_update_time")).toInstant(ZoneOffset.UTC).toEpochMilli();
- ecoSenseDevice.lastUpdateTime = LocalDateTime.parse(deviceNode.getString("last_update_time")).toInstant(ZoneOffset.UTC).toEpochMilli();
+ ecoSenseDevice.lastRadonUpdateTime = DATE_PARSER.parse(deviceNode.getString("last_radon_update_time")).getTime();
+ ecoSenseDevice.lastUpdateTime = DATE_PARSER.parse(deviceNode.getString("last_update_time")).getTime();
} catch (Exception e) {
logger.log(Level.WARNING, "Was unable to parse timestamp from EcoSense API.", e);
}
- devices.add(ecoSenseDevice);
+ return ecoSenseDevice;
}
} catch (MalformedURLException e) {
throw new RuntimeException(e);
@@ -165,7 +162,7 @@ public class EcoSenseCloudAPIClient {
throw new RuntimeException(e);
}
- return devices;
+ return null;
}
public class EcoSenseDevice {
diff --git a/plugins/hal-vendor-ecosense/src/se/hal/plugin/vendor/ecosense/EcoSenseController.java b/plugins/hal-vendor-ecosense/src/se/hal/plugin/vendor/ecosense/EcoSenseController.java
index 365c10b0..f1337a06 100644
--- a/plugins/hal-vendor-ecosense/src/se/hal/plugin/vendor/ecosense/EcoSenseController.java
+++ b/plugins/hal-vendor-ecosense/src/se/hal/plugin/vendor/ecosense/EcoSenseController.java
@@ -27,7 +27,7 @@ package se.hal.plugin.vendor.ecosense;
import se.hal.HalContext;
import se.hal.HalServer;
import se.hal.intf.*;
-import se.hal.plugin.vendor.ecosense.device.EccoCubeRadonSensorConfig;
+import se.hal.plugin.vendor.ecosense.device.EccoCubeRadonSensor;
import se.hal.struct.devicedata.RadonSensorData;
import zutil.ObjectUtil;
import zutil.log.LogUtil;
@@ -77,21 +77,19 @@ public class EcoSenseController implements HalSensorController, Runnable, HalDae
public void run() {
try {
if (!ObjectUtil.isEmpty(ecoSenseClient)) {
- List apiResponse = ecoSenseClient.getDevices();
- if (apiResponse.isEmpty()) {
- logger.info("Received no devices from EcoSense API.");
+ EcoSenseCloudAPIClient.EcoSenseDevice apiResponse = ecoSenseClient.getDevices();
+ if (apiResponse == null) {
+ logger.warning("Received empty response from EcoSense API.");
return;
}
- for (EcoSenseCloudAPIClient.EcoSenseDevice device : apiResponse) {
- EccoCubeRadonSensorConfig radonSensor = new EccoCubeRadonSensorConfig();
- radonSensor.setSerialNumber(device.serialNumber);
+ EccoCubeRadonSensor radonSensor = new EccoCubeRadonSensor();
+ radonSensor.setSerialNumber(apiResponse.serialNumber);
- RadonSensorData radonSensorData = new RadonSensorData(device.radonLevel, device.lastRadonUpdateTime);
+ RadonSensorData radonSensorData = new RadonSensorData(apiResponse.radonLevel, apiResponse.lastRadonUpdateTime);
- if (deviceReportListener != null) {
- deviceReportListener.reportReceived(radonSensor, radonSensorData);
- }
+ if (deviceReportListener != null) {
+ deviceReportListener.reportReceived(radonSensor, radonSensorData);
}
}
} catch (Exception e) {
diff --git a/plugins/hal-vendor-ecosense/src/se/hal/plugin/vendor/ecosense/device/EccoCubeRadonSensorConfig.java b/plugins/hal-vendor-ecosense/src/se/hal/plugin/vendor/ecosense/device/EccoCubeRadonSensor.java
similarity index 76%
rename from plugins/hal-vendor-ecosense/src/se/hal/plugin/vendor/ecosense/device/EccoCubeRadonSensorConfig.java
rename to plugins/hal-vendor-ecosense/src/se/hal/plugin/vendor/ecosense/device/EccoCubeRadonSensor.java
index f35b5e76..4c0d302a 100644
--- a/plugins/hal-vendor-ecosense/src/se/hal/plugin/vendor/ecosense/device/EccoCubeRadonSensorConfig.java
+++ b/plugins/hal-vendor-ecosense/src/se/hal/plugin/vendor/ecosense/device/EccoCubeRadonSensor.java
@@ -29,16 +29,12 @@ import se.hal.intf.HalSensorController;
import se.hal.intf.HalSensorData;
import se.hal.plugin.vendor.ecosense.EcoSenseController;
import se.hal.struct.devicedata.RadonSensorData;
-import zutil.ui.conf.Configurator;
-
-import java.util.Objects;
/**
* A sensor that calculate current radon level
*/
-public class EccoCubeRadonSensorConfig implements HalSensorConfig {
+public class EccoCubeRadonSensor implements HalSensorConfig {
- @Configurator.Configurable(value = "Device serial number")
private String serialNumber;
@@ -67,20 +63,7 @@ public class EccoCubeRadonSensorConfig implements HalSensorConfig {
}
@Override
- public final boolean equals(Object o) {
- if (!(o instanceof EccoCubeRadonSensorConfig)) return false;
-
- EccoCubeRadonSensorConfig that = (EccoCubeRadonSensorConfig) o;
- return Objects.equals(serialNumber, that.serialNumber);
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(serialNumber);
- }
-
- @Override
- public String toString() {
- return "Serial number: " + serialNumber;
+ public boolean equals(Object obj) {
+ return false;
}
}
diff --git a/plugins/hal-vendor-ecosense/src/se/hal/plugin/vendor/ecosense/plugin.json b/plugins/hal-vendor-ecosense/src/se/hal/plugin/vendor/ecosense/plugin.json
index d8f8d87f..71801055 100644
--- a/plugins/hal-vendor-ecosense/src/se/hal/plugin/vendor/ecosense/plugin.json
+++ b/plugins/hal-vendor-ecosense/src/se/hal/plugin/vendor/ecosense/plugin.json
@@ -5,6 +5,6 @@
"interfaces": [
{"se.hal.intf.HalAutostartController": "se.hal.plugin.vendor.ecosense.EcoSenseController"},
- {"se.hal.intf.HalSensorConfig": "se.hal.plugin.vendor.ecosense.device.EccoCubeRadonSensorConfig"}
+ {"se.hal.intf.HalSensorConfig": "se.hal.plugin.vendor.ecosense.device.EccoCubeRadonSensor"}
]
}
\ No newline at end of file
diff --git a/plugins/hal-vendor-tibber/build.gradle b/plugins/hal-vendor-tibber/build.gradle
index 6c541ab2..81fb360f 100644
--- a/plugins/hal-vendor-tibber/build.gradle
+++ b/plugins/hal-vendor-tibber/build.gradle
@@ -1,27 +1,3 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2025 Ziver Koc
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
dependencies {
implementation project(':hal-core')
}
diff --git a/plugins/hal-vendor-tibber/src/se/hal/plugin/vendor/tibber/TibberAPIClient.java b/plugins/hal-vendor-tibber/src/se/hal/plugin/vendor/tibber/TibberAPIClient.java
index dd84aa4e..3b6c11b0 100644
--- a/plugins/hal-vendor-tibber/src/se/hal/plugin/vendor/tibber/TibberAPIClient.java
+++ b/plugins/hal-vendor-tibber/src/se/hal/plugin/vendor/tibber/TibberAPIClient.java
@@ -35,8 +35,6 @@ import zutil.parser.json.JSONParser;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
-import java.time.LocalDateTime;
-import java.time.ZoneOffset;
import java.util.logging.Logger;
/**
@@ -46,6 +44,7 @@ public class TibberAPIClient {
private static final Logger logger = LogUtil.getLogger();
private static final String TIBBER_API_ENDPOINT = "https://api.tibber.com/v1-beta/gql";
+ private static SimpleDateFormat DATE_PARSER = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX"); // 2024-12-28T23:00:00.000+01:00
private String tibberToken;
@@ -81,16 +80,16 @@ public class TibberAPIClient {
"consumptionUnit " + // Should be Kwh
"}" +
"}" +
-// "currentSubscription {" +
-// "priceInfo {" +
-// "current {" +
-// "total " +
-// "energy " +
-// "tax " +
-// "startsAt " +
-// "}" +
-// "}" +
-// "}" +
+ "currentSubscription {" +
+ "priceInfo {" +
+ "current {" +
+ "total " +
+ "energy " +
+ "tax " +
+ "startsAt " +
+ "}" +
+ "}" +
+ "}" +
"}" +
"}" +
"}\"" +
@@ -101,7 +100,12 @@ public class TibberAPIClient {
// unitPrice=0.1507875, cost=0.3131856375, from=2024-12-28T21:00:00.000+01:00, consumption=2.077, to=2024-12-28T22:00:00.000+01:00, unitPriceVAT=0.0301575, consumptionUnit=kWh
TibberConsumption consumption = new TibberConsumption();
- consumption.timestamp = LocalDateTime.parse(data.getString("from")).toInstant(ZoneOffset.UTC).toEpochMilli();
+
+ try {
+ consumption.timestamp = DATE_PARSER.parse(data.getString("from")).getTime();
+ } catch (ParseException e) {
+ logger.warning("Was unable to parse timestamp from Tibber API.");
+ }
if (data.get("cost") != null) {
consumption.cost = data.getDouble("cost");
diff --git a/plugins/hal-vendor-tibber/src/se/hal/plugin/vendor/tibber/TibberController.java b/plugins/hal-vendor-tibber/src/se/hal/plugin/vendor/tibber/TibberController.java
index e6a72d7a..061a8ed6 100644
--- a/plugins/hal-vendor-tibber/src/se/hal/plugin/vendor/tibber/TibberController.java
+++ b/plugins/hal-vendor-tibber/src/se/hal/plugin/vendor/tibber/TibberController.java
@@ -27,9 +27,9 @@ package se.hal.plugin.vendor.tibber;
import se.hal.HalContext;
import se.hal.HalServer;
import se.hal.intf.*;
-import se.hal.plugin.vendor.tibber.device.TibberElectricityCostSensorConfig;
-import se.hal.plugin.vendor.tibber.device.TibberElectricityPriceSensorConfig;
-import se.hal.plugin.vendor.tibber.device.TibberPowerConsumptionSensorConfig;
+import se.hal.plugin.vendor.tibber.device.TibberElectricityCostSensor;
+import se.hal.plugin.vendor.tibber.device.TibberElectricityPriceSensor;
+import se.hal.plugin.vendor.tibber.device.TibberPowerConsumptionSensor;
import se.hal.struct.devicedata.PriceSensorData;
import se.hal.util.ListenerUtil;
import zutil.log.LogUtil;
@@ -92,13 +92,13 @@ public class TibberController implements HalSensorController, Runnable, HalDaemo
}
if (consumption.cost > 0) {
- ListenerUtil.callReportReceived(deviceListeners, new TibberElectricityCostSensorConfig(), new PriceSensorData(consumption.cost, consumption.timestamp));
+ ListenerUtil.callReportReceived(deviceListeners, new TibberElectricityCostSensor(), new PriceSensorData(consumption.cost, consumption.timestamp));
}
if (consumption.unitPriceVAT > 0) {
- ListenerUtil.callReportReceived(deviceListeners, new TibberElectricityPriceSensorConfig(), new PriceSensorData(consumption.unitPriceVAT, consumption.timestamp));
+ ListenerUtil.callReportReceived(deviceListeners, new TibberElectricityPriceSensor(), new PriceSensorData(consumption.unitPriceVAT, consumption.timestamp));
}
if (consumption.consumption > 0) {
- ListenerUtil.callReportReceived(deviceListeners, new TibberPowerConsumptionSensorConfig(), new PriceSensorData(consumption.consumption, consumption.timestamp));
+ ListenerUtil.callReportReceived(deviceListeners, new TibberPowerConsumptionSensor(), new PriceSensorData(consumption.consumption, consumption.timestamp));
}
} catch (Exception e) {
diff --git a/plugins/hal-vendor-tibber/src/se/hal/plugin/vendor/tibber/device/TibberElectricityCostSensorConfig.java b/plugins/hal-vendor-tibber/src/se/hal/plugin/vendor/tibber/device/TibberElectricityCostSensor.java
similarity index 93%
rename from plugins/hal-vendor-tibber/src/se/hal/plugin/vendor/tibber/device/TibberElectricityCostSensorConfig.java
rename to plugins/hal-vendor-tibber/src/se/hal/plugin/vendor/tibber/device/TibberElectricityCostSensor.java
index 36285960..49cc6dd2 100644
--- a/plugins/hal-vendor-tibber/src/se/hal/plugin/vendor/tibber/device/TibberElectricityCostSensorConfig.java
+++ b/plugins/hal-vendor-tibber/src/se/hal/plugin/vendor/tibber/device/TibberElectricityCostSensor.java
@@ -33,7 +33,7 @@ import se.hal.struct.devicedata.CostSensorData;
/**
* A sensor that calculate current electricity bil
*/
-public class TibberElectricityCostSensorConfig implements HalSensorConfig {
+public class TibberElectricityCostSensor implements HalSensorConfig {
@@ -59,6 +59,6 @@ public class TibberElectricityCostSensorConfig implements HalSensorConfig {
@Override
public boolean equals(Object obj) {
- return obj instanceof TibberElectricityCostSensorConfig;
+ return obj instanceof TibberElectricityCostSensor;
}
}
diff --git a/plugins/hal-vendor-tibber/src/se/hal/plugin/vendor/tibber/device/TibberElectricityPriceSensorConfig.java b/plugins/hal-vendor-tibber/src/se/hal/plugin/vendor/tibber/device/TibberElectricityPriceSensor.java
similarity index 93%
rename from plugins/hal-vendor-tibber/src/se/hal/plugin/vendor/tibber/device/TibberElectricityPriceSensorConfig.java
rename to plugins/hal-vendor-tibber/src/se/hal/plugin/vendor/tibber/device/TibberElectricityPriceSensor.java
index 0cb08beb..b7879fa5 100644
--- a/plugins/hal-vendor-tibber/src/se/hal/plugin/vendor/tibber/device/TibberElectricityPriceSensorConfig.java
+++ b/plugins/hal-vendor-tibber/src/se/hal/plugin/vendor/tibber/device/TibberElectricityPriceSensor.java
@@ -33,7 +33,7 @@ import se.hal.struct.devicedata.PriceSensorData;
/**
* A sensor that shows the price of electricity at a specific time
*/
-public class TibberElectricityPriceSensorConfig implements HalSensorConfig {
+public class TibberElectricityPriceSensor implements HalSensorConfig {
@@ -59,6 +59,6 @@ public class TibberElectricityPriceSensorConfig implements HalSensorConfig {
@Override
public boolean equals(Object obj) {
- return obj instanceof TibberElectricityPriceSensorConfig;
+ return obj instanceof TibberElectricityPriceSensor;
}
}
diff --git a/plugins/hal-vendor-tibber/src/se/hal/plugin/vendor/tibber/device/TibberPowerConsumptionSensorConfig.java b/plugins/hal-vendor-tibber/src/se/hal/plugin/vendor/tibber/device/TibberPowerConsumptionSensor.java
similarity index 93%
rename from plugins/hal-vendor-tibber/src/se/hal/plugin/vendor/tibber/device/TibberPowerConsumptionSensorConfig.java
rename to plugins/hal-vendor-tibber/src/se/hal/plugin/vendor/tibber/device/TibberPowerConsumptionSensor.java
index fad3cd15..7df1ecf1 100644
--- a/plugins/hal-vendor-tibber/src/se/hal/plugin/vendor/tibber/device/TibberPowerConsumptionSensorConfig.java
+++ b/plugins/hal-vendor-tibber/src/se/hal/plugin/vendor/tibber/device/TibberPowerConsumptionSensor.java
@@ -31,7 +31,7 @@ import se.hal.struct.devicedata.PowerConsumptionSensorData;
import se.hal.plugin.vendor.tibber.TibberController;
-public class TibberPowerConsumptionSensorConfig implements HalSensorConfig {
+public class TibberPowerConsumptionSensor implements HalSensorConfig {
@Override
@@ -56,6 +56,6 @@ public class TibberPowerConsumptionSensorConfig implements HalSensorConfig {
@Override
public boolean equals(Object obj) {
- return obj instanceof TibberPowerConsumptionSensorConfig;
+ return obj instanceof TibberPowerConsumptionSensor;
}
}
diff --git a/plugins/hal-vendor-tibber/src/se/hal/plugin/vendor/tibber/plugin.json b/plugins/hal-vendor-tibber/src/se/hal/plugin/vendor/tibber/plugin.json
index e9392f9b..a1dfac72 100644
--- a/plugins/hal-vendor-tibber/src/se/hal/plugin/vendor/tibber/plugin.json
+++ b/plugins/hal-vendor-tibber/src/se/hal/plugin/vendor/tibber/plugin.json
@@ -5,8 +5,8 @@
"interfaces": [
{"se.hal.intf.HalAutostartController": "se.hal.plugin.vendor.tibber.TibberController"},
- {"se.hal.intf.HalSensorConfig": "se.hal.plugin.vendor.tibber.device.TibberElectricityCostSensorConfig"},
- {"se.hal.intf.HalSensorConfig": "se.hal.plugin.vendor.tibber.device.TibberElectricityPriceSensorConfig"},
- {"se.hal.intf.HalSensorConfig": "se.hal.plugin.vendor.tibber.device.TibberPowerConsumptionSensorConfig"}
+ {"se.hal.intf.HalSensorConfig": "se.hal.plugin.vendor.tibber.device.TibberElectricityCostSensor"},
+ {"se.hal.intf.HalSensorConfig": "se.hal.plugin.vendor.tibber.device.TibberElectricityPriceSensor"},
+ {"se.hal.intf.HalSensorConfig": "se.hal.plugin.vendor.tibber.device.TibberPowerConsumptionSensor"}
]
}
\ No newline at end of file