]> git.basschouten.com Git - openhab-addons.git/commitdiff
[keba] Split channel ENABLED to USER and SYSTEM channels (#15531)
authorSimon Spielmann <simon.spielmann@gmx.de>
Fri, 3 Nov 2023 19:48:39 +0000 (20:48 +0100)
committerGitHub <noreply@github.com>
Fri, 3 Nov 2023 19:48:39 +0000 (20:48 +0100)
* Split channel ENABLED to USER and SYSTEM channels

---------

Signed-off-by: Simon Spielmann <simon.spielmann@gmx.de>
bundles/org.openhab.binding.keba/README.md
bundles/org.openhab.binding.keba/src/main/java/org/openhab/binding/keba/internal/KebaBindingConstants.java
bundles/org.openhab.binding.keba/src/main/java/org/openhab/binding/keba/internal/handler/KeContactHandler.java
bundles/org.openhab.binding.keba/src/main/resources/OH-INF/i18n/keba.properties
bundles/org.openhab.binding.keba/src/main/resources/OH-INF/thing/kecontact.xml
bundles/org.openhab.binding.keba/src/main/resources/OH-INF/update/kecontact-enabled.xml [new file with mode: 0644]

index 66ceb65677f5239b56d86f27cb78d1b06f0587f6..1250d0246cba30bee3f6856f5d6845f0d9c53b8b 100644 (file)
@@ -18,7 +18,8 @@ All devices support the following channels:
 | Channel ID              | Item Type                | Read-only | Description                                                             |
 | ----------------------- | ------------------------ | --------- | ----------------------------------------------------------------------- |
 | state                   | Number                   | yes       | current operational state of the wallbox                                |
-| enabled                 | Switch                   | no        | activation state of the wallbox                                         |
+| enabledsystem           | Switch                   | yes       | activation state of the wallbox (System)                                |
+| enableduser             | Switch                   | no        | activation state of the wallbox (User)                                  |
 | maxpresetcurrent        | Number:ElectricCurrent   | no        | maximum current the charging station should deliver to the EV in A      |
 | maxpresetcurrentrange   | Number:Dimensionless     | no        | maximum current the charging station should deliver to the EV in %      |
 | power                   | Number:Power             | yes       | active power delivered by the charging station                          |
@@ -63,7 +64,8 @@ Number:ElectricCurrent    KebaCurrent           "Maximum supply current [%.3f A]
 Number:ElectricCurrent    KebaSystemCurrent     "Maximum system supply current [%.3f A]"  {channel="keba:kecontact:1:maxsystemcurrent"} 
 Number:ElectricCurrent    KebaFailSafeCurrent   "Failsafe supply current [%.3f A]"        {channel="keba:kecontact:1:failsafecurrent"} 
 Number                    KebaState             "Operating State [%s]"                    {channel="keba:kecontact:1:state"}
-Switch                    KebaSwitch            "Enabled"                                 {channel="keba:kecontact:1:enabled"}
+Switch                    KebaEnabledSystem     "Enabled (System)"                        {channel="keba:kecontact:1:enabledsystem"}
+Switch                    KebaEnabledUser       "Enabled (User)"                          {channel="keba:kecontact:1:enableduser"}  
 Switch                    KebaWallboxPlugged    "Plugged into wallbox"                    {channel="keba:kecontact:1:wallbox"}
 Switch                    KebaVehiclePlugged    "Plugged into vehicle"                    {channel="keba:kecontact:1:vehicle"}
 Switch                    KebaPlugLocked        "Plug locked"                             {channel="keba:kecontact:1:locked"}
@@ -90,7 +92,8 @@ sitemap demo label="Main Menu"
  Text label="Charging Station" {
   Text  item=KebaState
   Text  item=KebaUptime
-  Switch  item=KebaSwitch
+  Switch  item=KebaEnabledSystem
+  Switch  item=KebaEnabledUser
   Switch  item=KebaWallboxPlugged
   Switch  item=KebaVehiclePlugged
   Switch  item=KebaPlugLocked
index 417225b934828b84604625ba80109f04511fb6cc..e722399f579341d0e0710eba4865c73b5fef06b0 100644 (file)
@@ -41,7 +41,8 @@ public class KebaBindingConstants {
     public static final String CHANNEL_WALLBOX = "wallbox";
     public static final String CHANNEL_VEHICLE = "vehicle";
     public static final String CHANNEL_PLUG_LOCKED = "locked";
-    public static final String CHANNEL_ENABLED = "enabled";
+    public static final String CHANNEL_ENABLED_SYSTEM = "enabledsystem";
+    public static final String CHANNEL_ENABLED_USER = "enableduser";
     public static final String CHANNEL_PILOT_CURRENT = "maxpilotcurrent";
     public static final String CHANNEL_PILOT_PWM = "maxpilotcurrentdutycyle";
     public static final String CHANNEL_MAX_SYSTEM_CURRENT = "maxsystemcurrent";
index 49bb3335290a9789db8fec61c78fab1b1ff5b9fc..5e62eada3a3d073e4e4eae38abe1327643304355 100644 (file)
@@ -323,17 +323,11 @@ public class KeContactHandler extends BaseThingHandler {
                         break;
                     }
                     case "Enable sys": {
-                        int state = entry.getValue().getAsInt();
-                        switch (state) {
-                            case 1: {
-                                updateState(CHANNEL_ENABLED, OnOffType.ON);
-                                break;
-                            }
-                            default: {
-                                updateState(CHANNEL_ENABLED, OnOffType.OFF);
-                                break;
-                            }
-                        }
+                        updateState(CHANNEL_ENABLED_SYSTEM, OnOffType.from(entry.getValue().getAsInt() == 1));
+                        break;
+                    }
+                    case "Enable user": {
+                        updateState(CHANNEL_ENABLED_USER, OnOffType.from(entry.getValue().getAsInt() == 1));
                         break;
                     }
                     case "Curr HW": {
@@ -558,7 +552,7 @@ public class KeContactHandler extends BaseThingHandler {
                     }
                     break;
                 }
-                case CHANNEL_ENABLED: {
+                case CHANNEL_ENABLED_USER: {
                     if (command instanceof OnOffType) {
                         if (command == OnOffType.ON) {
                             transceiver.send("ena 1", this);
index a43c6673c1e09491012217a94dd2dc1bd700e4df..a3b59b6d13c7ed84bbb8f2e6362b9a6e5a120e88 100644 (file)
@@ -35,8 +35,10 @@ channel-type.keba.current_settable.label = Preset Current
 channel-type.keba.current_settable.description = Preset Current
 channel-type.keba.display.label = Display
 channel-type.keba.display.description = Text to show on the P30 Series C or X display
-channel-type.keba.enabled.label = Enabled
-channel-type.keba.enabled.description = Activation state of the wallbox
+channel-type.keba.enabledsystem.label = Enabled (System)
+channel-type.keba.enabledsystem.description = Activation state of the wallbox (System)
+channel-type.keba.enableduser.label = Enabled (User)
+channel-type.keba.enableduser.description = Activation state of the wallbox (User)
 channel-type.keba.energy.label = Energy Session
 channel-type.keba.energy.description = Power consumption
 channel-type.keba.error1.label = Error Code 1
index cccbe07bc666a34044d4f07e33423d26f8642608..c474648c7dc38c51846aae95c0bf19ff988f84c0 100644 (file)
@@ -9,7 +9,8 @@
                <description>A KeContact EV Charging Station</description>
 
                <channels>
-                       <channel id="enabled" typeId="enabled"/>
+                       <channel id="enabledsystem" typeId="enabledsystem"/>
+                       <channel id="enableduser" typeId="enableduser"/>
                        <channel id="state" typeId="state"/>
                        <channel id="maxpresetcurrent" typeId="current_settable"/>
                        <channel id="maxpresetcurrentrange" typeId="range"/>
                        <channel id="authenticate" typeId="authenticate"/>
                </channels>
 
+               <properties>
+                       <property name="thingTypeVersion">1</property>
+               </properties>
+
                <config-description>
                        <parameter name="ipAddress" type="text" required="true">
                                <label>Network Address</label>
                <description>Indicator if the plug is locked by the electrical vehicle</description>
                <state readOnly="true"></state>
        </channel-type>
-       <channel-type id="enabled">
+       <channel-type id="enabledsystem">
+               <item-type>Switch</item-type>
+               <label>Enabled (System)</label>
+               <description>Activation state of the wallbox (System)</description>
+               <state readOnly="true"></state>
+       </channel-type>
+       <channel-type id="enableduser">
                <item-type>Switch</item-type>
-               <label>Enabled</label>
-               <description>Activation state of the wallbox</description>
+               <label>Enabled (User)</label>
+               <description>Activation state of the wallbox (User)</description>
                <state readOnly="false"></state>
        </channel-type>
        <channel-type id="x1" advanced="true">
diff --git a/bundles/org.openhab.binding.keba/src/main/resources/OH-INF/update/kecontact-enabled.xml b/bundles/org.openhab.binding.keba/src/main/resources/OH-INF/update/kecontact-enabled.xml
new file mode 100644 (file)
index 0000000..015e98f
--- /dev/null
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<update:update-descriptions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:update="https://openhab.org/schemas/update-description/v1.0.0"
+       xsi:schemaLocation="https://openhab.org/schemas/update-description/v1.0.0 https://openhab.org/schemas/update-description-1.0.0.xsd">
+
+       <thing-type uid="keba:kecontact">
+               <instruction-set targetVersion="1">
+                       <remove-channel id="enabled"/>
+                       <add-channel id="enabledsystem">
+                               <type>keba:enabledsystem</type>
+                       </add-channel>
+                       <add-channel id="enableduser">
+                               <type>keba:enableduser</type>
+                       </add-channel>
+               </instruction-set>
+       </thing-type>
+
+</update:update-descriptions>