]> git.basschouten.com Git - openhab-addons.git/commitdiff
[solarwatt] Add smart heater device support (#14741)
authorThomas <thomas.schumm@yahoo.de>
Thu, 6 Apr 2023 09:06:46 +0000 (11:06 +0200)
committerGitHub <noreply@github.com>
Thu, 6 Apr 2023 09:06:46 +0000 (11:06 +0200)
* Add smart heater device support

Signed-off-by: Thomas Schumm <thomas.schumm@yahoo.de>
bundles/org.openhab.binding.solarwatt/README.md
bundles/org.openhab.binding.solarwatt/src/main/java/org/openhab/binding/solarwatt/internal/SolarwattBindingConstants.java
bundles/org.openhab.binding.solarwatt/src/main/java/org/openhab/binding/solarwatt/internal/SolarwattHandlerFactory.java
bundles/org.openhab.binding.solarwatt/src/main/java/org/openhab/binding/solarwatt/internal/discovery/SolarwattDevicesDiscoveryService.java
bundles/org.openhab.binding.solarwatt/src/main/java/org/openhab/binding/solarwatt/internal/domain/model/SmartHeater.java [new file with mode: 0644]
bundles/org.openhab.binding.solarwatt/src/main/java/org/openhab/binding/solarwatt/internal/factory/EnergyManagerDevicesFactory.java
bundles/org.openhab.binding.solarwatt/src/main/resources/OH-INF/i18n/solarwatt.properties
bundles/org.openhab.binding.solarwatt/src/main/resources/OH-INF/thing/thing-types.xml

index 93ccb5b184199a548be66e6ab5e268700f4bb0ac..1b07785b306c6127cba06511c48297081ac7339c 100644 (file)
@@ -7,7 +7,7 @@ All supported values and devices were discovered while playing with my own energ
 ## Supported Things
 
 | Thing Type ID    | Devices                                                |
-| ---------------- | ------------------------------------------------------ |
+|------------------|--------------------------------------------------------|
 | energymanager    | EnergyManager itself.                                  |
 | location         | Location part of the EnergyManager.                    |
 | pvplant          | Power producing part of the EnergyManager.             |
@@ -16,6 +16,7 @@ All supported values and devices were discovered while playing with my own energ
 | batteryconverter | battery storage systems; e.g. MyReserve                |
 | powermeter       | powermeters; e.g. S0BusCounter, MyReserve              |
 | evstation        | electric-vehicle charging station; e.g. Keba Wallbox   |
+| smartheater      | Radiators for PV systems; e.g. EGO SmartHeater         |
 
 ## Discovery
 
@@ -141,6 +142,18 @@ All of _Inverter_ plus
 | --------------- | -------------------- | ----------------------------------- |
 | feedInLimit     | Number:Dimensionless | Current derating setting in percent |
 
+### SmartHeater
+
+| Channel Type ID   | Item Type          | Description                            |
+|-------------------|--------------------|----------------------------------------|
+| workACIn          | Number:Energy      | Energy fed into smart heater           |
+| powerACIn         | Number:Power       | Power fed into smart heater            |
+| temperature       | Number:Temperature | Current heating temperature in celsius |
+| temperatureBoiler | Number:Temperature | Current boiler temperature in celsius  |
+| temperatureSet    | Number:Temperature | Set temperature                        |
+| temperatureSetMin | Number:Temperature | Minimum adjustable temperature         |
+| temperatureSetMax | Number:Temperature | Maximum adjustable temperature         |
+
 ## Example
 
 demo.things:
@@ -249,4 +262,13 @@ Number Solarwatt_Manager_ERC05000008007_FractionCPULoadAverageLastFifteenMinutes
 // Gridflow com.kiwigrid.kiwiapp.gridflow.GridFlow
 Number Solarwatt_Gridflow_UrnKiwigridGridflowERC05000008007_CurrentLimit "CurrentLimit [%d A]" <energy> ["Point"]  {channel="solarwatt:gridflow:56f4ac2fa2:urn-kiwigrid-gridflow-ERC05-000008007:currentLimit"}
 Number Solarwatt_Gridflow_UrnKiwigridGridflowERC05000008007_FeedInLimit "FeedInLimit [%d %%]" <status> ["Point"]  {channel="solarwatt:gridflow:56f4ac2fa2:urn-kiwigrid-gridflow-ERC05-000008007:feedInLimit"}
+
+// SmartHeater com.kiwigrid.devices.smartheater.SmartHeater
+Number:Power Solarwatt_Smartheater_UrnEgoSmartheater62018833_PowerACIn "SmartHeater powerACIn [%.2f W]" <energy> { channel="solarwatt:smartheater:urn-ego-smartheater-62018833:powerACIn" }
+Number:Energy Solarwatt_Smartheater_UrnEgoSmartheater62018833_WorkACIn "SmartHeater workACIn [%.2f Wh]" <energy> { channel="solarwatt:smartheater:urn-ego-smartheater-62018833:workACIn" }
+Number:Temperature Solarwatt_Smartheater_UrnEgoSmartheater62018833_TemperatureBoiler "SmartHeater temperatureBoiler [%.1f °C]" <temperature> { channel="solarwatt:smartheater:urn-ego-smartheater-62018833:temperatureBoiler" }
+Number:Temperature Solarwatt_Smartheater_UrnEgoSmartheater62018833_Temperature "SmartHeater temperature [%.1f °C]" <temperature> { channel="solarwatt:smartheater:urn-ego-smartheater-62018833:temperature" }
+Number:Temperature Solarwatt_Smartheater_UrnEgoSmartheater62018833_TemperatureSet "SmartHeater temperatureSet [%.1f °C]" <temperature> { channel="solarwatt:smartheater:urn-ego-smartheater-62018833:temperatureSet" }
+Number:Temperature Solarwatt_Smartheater_UrnEgoSmartheater62018833_TemperatureSetMax "SmartHeater temperatureSetMax [%.1f °C]" <temperature> { channel="solarwatt:smartheater:urn-ego-smartheater-62018833:temperatureSetMax" }
+Number:Temperature Solarwatt_Smartheater_UrnEgoSmartheater62018833_TemperatureSetMin "SmartHeater temperatureSetMin [%.1f °C]" <temperature> { channel="solarwatt:smartheater:urn-ego-smartheater-62018833:temperatureSetMin" }
 ```
index 1bf493abccbb5ca19b0c18c418ea332619198f29..05b0f9b1acd7e892eaa4a5f668bfe1d4e5ce4fe7 100644 (file)
@@ -39,6 +39,7 @@ public class SolarwattBindingConstants {
     public static final ThingTypeUID THING_TYPE_EVSTATION = new ThingTypeUID(BINDING_ID, "evstation");
     public static final ThingTypeUID THING_TYPE_PVPLANT = new ThingTypeUID(BINDING_ID, "pvplant");
     public static final ThingTypeUID THING_TYPE_GRIDFLOW = new ThingTypeUID(BINDING_ID, "gridflow");
+    public static final ThingTypeUID THING_TYPE_SMARTHEATER = new ThingTypeUID(BINDING_ID, "smartheater");
 
     public static final String PROPERTY_ID_NAME = "IdName";
     public static final String PROPERTY_ID_FIRMWARE = "IdFirmware";
@@ -116,6 +117,11 @@ public class SolarwattBindingConstants {
     public static final SolarwattTag CHANNEL_VOLTAGE_BATTERY_CELL_MAX = new SolarwattTag("VoltageBatteryCellMax");
     public static final SolarwattTag CHANNEL_VOLTAGE_BATTERY_CELL_MIN = new SolarwattTag("VoltageBatteryCellMin");
     public static final SolarwattTag CHANNEL_VOLTAGE_BATTERY_CELL_MEAN = new SolarwattTag("VoltageBatteryCellMean");
+    public static final SolarwattTag CHANNEL_TEMPERATURE = new SolarwattTag("Temperature");
+    public static final SolarwattTag CHANNEL_TEMPERATURE_SET_MAX = new SolarwattTag("TemperatureSetMax");
+    public static final SolarwattTag CHANNEL_TEMPERATURE_BOILER = new SolarwattTag("TemperatureBoiler");
+    public static final SolarwattTag CHANNEL_TEMPERATURE_SET_MIN = new SolarwattTag("TemperatureSetMin");
+    public static final SolarwattTag CHANNEL_TEMPERATURE_SET = new SolarwattTag("TemperatureSet");
 
     // thing configuration and properties keys
     public static final String THING_PROPERTIES_GUID = "guid";
index 49eef07c9f6257e592441a483484dc4075db0b79..69bac8ddc6f3f969d73429c89fbd346a4b8b0837 100644 (file)
@@ -46,7 +46,7 @@ public class SolarwattHandlerFactory extends BaseThingHandlerFactory {
 
     private static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Set.of(THING_TYPE_ENERGY_MANAGER,
             THING_TYPE_INVERTER, THING_TYPE_POWERMETER, THING_TYPE_EVSTATION, THING_TYPE_BATTERYCONVERTER,
-            THING_TYPE_LOCATION, THING_TYPE_PVPLANT, THING_TYPE_GRIDFLOW);
+            THING_TYPE_LOCATION, THING_TYPE_PVPLANT, THING_TYPE_GRIDFLOW, THING_TYPE_SMARTHEATER);
 
     private final HttpClient commonHttpClient;
     private final SolarwattChannelTypeProvider channelTypeProvider;
index f7e4215655f99cb896ce975f458d36f687e3ef36..67ce4926445e50e4e9cd204595b3eac53d2a303c 100644 (file)
  */
 package org.openhab.binding.solarwatt.internal.discovery;
 
-import static org.openhab.binding.solarwatt.internal.SolarwattBindingConstants.*;
+import static org.openhab.binding.solarwatt.internal.SolarwattBindingConstants.THING_PROPERTIES_GUID;
+import static org.openhab.binding.solarwatt.internal.SolarwattBindingConstants.THING_TYPE_BATTERYCONVERTER;
+import static org.openhab.binding.solarwatt.internal.SolarwattBindingConstants.THING_TYPE_EVSTATION;
+import static org.openhab.binding.solarwatt.internal.SolarwattBindingConstants.THING_TYPE_GRIDFLOW;
+import static org.openhab.binding.solarwatt.internal.SolarwattBindingConstants.THING_TYPE_INVERTER;
+import static org.openhab.binding.solarwatt.internal.SolarwattBindingConstants.THING_TYPE_LOCATION;
+import static org.openhab.binding.solarwatt.internal.SolarwattBindingConstants.THING_TYPE_POWERMETER;
+import static org.openhab.binding.solarwatt.internal.SolarwattBindingConstants.THING_TYPE_PVPLANT;
+import static org.openhab.binding.solarwatt.internal.SolarwattBindingConstants.THING_TYPE_SMARTHEATER;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -29,6 +37,7 @@ import org.openhab.binding.solarwatt.internal.domain.model.Inverter;
 import org.openhab.binding.solarwatt.internal.domain.model.Location;
 import org.openhab.binding.solarwatt.internal.domain.model.PVPlant;
 import org.openhab.binding.solarwatt.internal.domain.model.PowerMeter;
+import org.openhab.binding.solarwatt.internal.domain.model.SmartHeater;
 import org.openhab.binding.solarwatt.internal.handler.EnergyManagerHandler;
 import org.openhab.core.config.discovery.AbstractDiscoveryService;
 import org.openhab.core.config.discovery.DiscoveryResult;
@@ -137,6 +146,7 @@ public class SolarwattDevicesDiscoveryService extends AbstractDiscoveryService
                 this.logger.warn("No device data for solarwatt devices in discovery for energy manager {}.", bridgeUID);
             } else {
                 devices.forEach((key, entry) -> {
+                    this.logger.debug("scanForDeviceThings: {}-{}", entry.getClass(), entry.getGuid());
                     if (entry instanceof BatteryConverter) {
                         this.discover(bridgeUID, entry, THING_TYPE_BATTERYCONVERTER);
                     } else if (entry instanceof Inverter) {
@@ -151,6 +161,10 @@ public class SolarwattDevicesDiscoveryService extends AbstractDiscoveryService
                         this.discover(bridgeUID, entry, THING_TYPE_PVPLANT);
                     } else if (entry instanceof GridFlow) {
                         this.discover(bridgeUID, entry, THING_TYPE_GRIDFLOW);
+                    } else if (entry instanceof SmartHeater) {
+                        this.discover(bridgeUID, entry, THING_TYPE_SMARTHEATER);
+                    } else {
+                        this.logger.debug("Found unhandled device");
                     }
                 });
             }
diff --git a/bundles/org.openhab.binding.solarwatt/src/main/java/org/openhab/binding/solarwatt/internal/domain/model/SmartHeater.java b/bundles/org.openhab.binding.solarwatt/src/main/java/org/openhab/binding/solarwatt/internal/domain/model/SmartHeater.java
new file mode 100644 (file)
index 0000000..ecf7eb1
--- /dev/null
@@ -0,0 +1,81 @@
+/**
+ * Copyright (c) 2010-2023 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.solarwatt.internal.domain.model;
+
+import static org.openhab.binding.solarwatt.internal.SolarwattBindingConstants.*;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.openhab.binding.solarwatt.internal.domain.dto.DeviceDTO;
+
+/**
+ * Base class for a EGO Smart Heaters ... see
+ * https://www.solarwatt.de/betriebsanleitungen/solarwatt-manager/solarwatt-manager-flex/geraete-verbinden/ego-smartheater
+ *
+ * This fields have been identified to exist:
+ * com.kiwigrid.devices.smartheater.SmartHeater=[
+ * TemperatureSetMax,
+ * PowerACInLimit,
+ * Temperature,
+ * DateProduction,
+ * IdFingerPrint,
+ * StateVisibleIsSet,
+ * StateErrorList,
+ * PasswordLock,
+ * IdManufacturer,
+ * WorkACIn,
+ * PowerACInLimits,
+ * TemperatureBoiler,
+ * IdFirmware,
+ * IdModelCode,
+ * IdName,
+ * IdInterfaceList,
+ * TemperatureSetMin,
+ * IdDriver,
+ * StateDevice,
+ * TemperatureSet,
+ * PowerACIn,
+ * IdSerialNumber,
+ * PowerACInMax,
+ * IdFingerPrintVersion,
+ * IdLabelSet,
+ * StateLockedIsSet
+ * ]
+ *
+ * @author Thomas Schumm - Initial contribution
+ */
+@NonNullByDefault
+public class SmartHeater extends Device {
+    public static final String SOLAR_WATT_CLASSNAME = "com.kiwigrid.devices.smartheater.SmartHeater";
+
+    public SmartHeater(DeviceDTO deviceDTO) {
+        super(deviceDTO);
+    }
+
+    @Override
+    public void update(DeviceDTO deviceDTO) {
+        super.update(deviceDTO);
+
+        this.addWattHourQuantity(CHANNEL_WORK_AC_IN, deviceDTO);
+        this.addWattQuantity(CHANNEL_POWER_AC_IN, deviceDTO);
+        this.addCelsiusQuantity(CHANNEL_TEMPERATURE, deviceDTO);
+        this.addCelsiusQuantity(CHANNEL_TEMPERATURE_SET_MAX, deviceDTO);
+        this.addCelsiusQuantity(CHANNEL_TEMPERATURE_BOILER, deviceDTO);
+        this.addCelsiusQuantity(CHANNEL_TEMPERATURE_SET_MIN, deviceDTO);
+        this.addCelsiusQuantity(CHANNEL_TEMPERATURE_SET, deviceDTO);
+    }
+
+    @Override
+    protected String getSolarWattLabel() {
+        return "SmartHeater";
+    }
+}
index ea52b7b729b8b0798395072f3cca1822c2678eab..d30a895ebf48a9927ebfbff9aa9fcd29e8302b5e 100644 (file)
@@ -36,6 +36,7 @@ import org.openhab.binding.solarwatt.internal.domain.model.S0Counter;
 import org.openhab.binding.solarwatt.internal.domain.model.ScheduleApp;
 import org.openhab.binding.solarwatt.internal.domain.model.SimpleSwitcher;
 import org.openhab.binding.solarwatt.internal.domain.model.SmartEnergyManagement;
+import org.openhab.binding.solarwatt.internal.domain.model.SmartHeater;
 import org.openhab.binding.solarwatt.internal.domain.model.SunSpecInverter;
 
 /**
@@ -125,6 +126,9 @@ public class EnergyManagerDevicesFactory {
         if (deviceDTO.getDeviceModelStrings().contains(ProfileApp.SOLAR_WATT_CLASSNAME)) {
             return new ProfileApp(deviceDTO);
         }
+        if (deviceDTO.getDeviceModelStrings().contains(SmartHeater.SOLAR_WATT_CLASSNAME)) {
+            return new SmartHeater(deviceDTO);
+        }
 
         // Objects on level 0
         if (deviceDTO.getDeviceModelStrings().contains(Device.SOLAR_WATT_CLASSNAME)) {
index d9e3a1bbf99b9e1392a3538629ca36d7206ab7ac..8e0c044766bffdd4f501e907c7063e5561bfb3a7 100644 (file)
@@ -21,6 +21,8 @@ thing-type.solarwatt.powermeter.label = Power Meter
 thing-type.solarwatt.powermeter.description = Power meter for produced or consumed energy
 thing-type.solarwatt.pvplant.label = PV Plant
 thing-type.solarwatt.pvplant.description = Photovoltaic plant generating DC from solar energy.
+thing-type.solarwatt.smartheater.label = SmartHeater
+thing-type.solarwatt.smartheater.description = Smart heater for the production of hot water.
 
 # thing types config
 
index de96778fe9a3cfd30de37b21cea1069da86aea2e..10b57463a196b0013ccadc4749809339ec540e1c 100644 (file)
                <config-description-ref uri="thing-type:solarwatt:device"/>
        </thing-type>
 
+       <thing-type id="smartheater">
+               <supported-bridge-type-refs>
+                       <bridge-type-ref id="energymanager"/>
+               </supported-bridge-type-refs>
+
+               <label>SmartHeater</label>
+               <description>Smart heater for the production of hot water.</description>
+
+               <representation-property>IdName</representation-property>
+
+               <config-description-ref uri="thing-type:solarwatt:device"/>
+       </thing-type>
+
 </thing:thing-descriptions>