]> git.basschouten.com Git - openhab-addons.git/commitdiff
[tesla] Change center_display_state from switch to number (#12030)
authorKai Kreuzer <kai@openhab.org>
Wed, 12 Jan 2022 22:06:31 +0000 (23:06 +0100)
committerGitHub <noreply@github.com>
Wed, 12 Jan 2022 22:06:31 +0000 (23:06 +0100)
* Change center_display_state from switch to number

Signed-off-by: Kai Kreuzer <kai@openhab.org>
* Update property file

Signed-off-by: Kai Kreuzer <kai@openhab.org>
bundles/org.openhab.binding.tesla/README.md
bundles/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/TeslaChannelSelectorProxy.java
bundles/org.openhab.binding.tesla/src/main/resources/OH-INF/i18n/tesla.properties
bundles/org.openhab.binding.tesla/src/main/resources/OH-INF/thing/channels.xml

index de852632f9a9b7c5e4448bd638213e2bc514a346..5265e45c89c282fb0504c5b87b3166027d6b90d9 100644 (file)
@@ -100,7 +100,7 @@ Additionally, these advanced channels are available (not all are available on al
 | batteryheaternopower      | Switch                   | Battery Heater Power          | Indicates if there is enough power to use the battery heater                                                     |
 | batteryrange              | Number:Length            | Battery Range                 | Range of the battery                                                                                             |
 | calendarenabled           | Switch                   | Calendar Enabled              | Indicates if access to a remote calendar is enabled                                                              |
-| centerdisplay             | Switch                   | Central Display State         | Indicates the state of the central display in the vehicle                                                        |
+| centerdisplay             | Number                   | Central Display State         | Indicates the state of the central display in the vehicle, see [here](https://tesla-api.timdorr.com/vehicle/state/vehiclestate) for valid values |                                                 
 | centerrearseatheater      | Switch                   | Center Rear Seat Heater       | Indicates if the center rear seat heater is switched on                                                          |
 | charge                    | Switch                   | Charge                        | Start (ON) or stop (OFF) charging                                                                                |
 | chargecable               | String                   | Charge Cable                  | Undocumented / To be defined                                                                                     |
index 67d1965c362f926dc8fcbc5339abff5afca6daa0..0e2bb8884e296c0da2cf100acb46fa118fed34e6 100644 (file)
@@ -119,18 +119,7 @@ public class TeslaChannelSelectorProxy {
             }
         },
         CAR_VERSION("car_version", "version", StringType.class, true),
-        CENTER_DISPLAY("center_display_state", "centerdisplay", OnOffType.class, false) {
-            @Override
-            public State getState(String s, TeslaChannelSelectorProxy proxy, Map<String, String> properties) {
-                if (s.equals("true") || s.equals("1")) {
-                    return super.getState("ON");
-                }
-                if (s.equals("false") || s.equals("0")) {
-                    return super.getState("OFF");
-                }
-                return super.getState(s);
-            }
-        },
+        CENTER_DISPLAY("center_display_state", "centerdisplay", DecimalType.class, false),
         CHARGE(null, "charge", OnOffType.class, false) {
             @Override
             public State getState(String s, TeslaChannelSelectorProxy proxy, Map<String, String> properties) {
index 456337296b30b58c9c7210d93d4633e29d5932d5..1bd21f1fbd3d9dca4e9ab9b8d7636c16b9083d8e 100644 (file)
@@ -71,6 +71,15 @@ channel-type.tesla.calendarenabled.label = Calendar Enabled
 channel-type.tesla.calendarenabled.description = Indicates if access to a remote calendar is enabled
 channel-type.tesla.centerdisplay.label = Central Display State
 channel-type.tesla.centerdisplay.description = Indicates the state of the central display in the vehicle
+channel-type.tesla.centerdisplay.state.option.0 = Off
+channel-type.tesla.centerdisplay.state.option.2 = On, Standby or Camp Mode
+channel-type.tesla.centerdisplay.state.option.3 = On, Charging Screen
+channel-type.tesla.centerdisplay.state.option.4 = On
+channel-type.tesla.centerdisplay.state.option.5 = On, Big Charging Screen
+channel-type.tesla.centerdisplay.state.option.6 = On, Ready to Unlock
+channel-type.tesla.centerdisplay.state.option.7 = Sentry Mode
+channel-type.tesla.centerdisplay.state.option.8 = Dog Mode
+channel-type.tesla.centerdisplay.state.option.9 = Media
 channel-type.tesla.centerrearseatheater.label = Center Rear Seat Heater
 channel-type.tesla.centerrearseatheater.description = Indicates if the center rear seat heater is switched on
 channel-type.tesla.charge.label = Charge
index de6cb004abc3b6c77d1e7be06727ff3c5c08a71e..abf97d9dad861df04538ea5bdc0514cd514a97d0 100644 (file)
                <state readOnly="true"></state>
        </channel-type>
        <channel-type id="centerdisplay" advanced="true">
-               <item-type>Switch</item-type>
+               <item-type>Number</item-type>
                <label>Central Display State</label>
                <description>Indicates the state of the central display in the vehicle</description>
-               <state readOnly="true"></state>
+               <state readOnly="true">
+                       <options>
+                               <option value="0">Off</option>
+                               <option value="2">On, Standby or Camp Mode</option>
+                               <option value="3">On, Charging Screen</option>
+                               <option value="4">On</option>
+                               <option value="5">On, Big Charging Screen</option>
+                               <option value="6">On, Ready to Unlock</option>
+                               <option value="7">Sentry Mode</option>
+                               <option value="8">Dog Mode</option>
+                               <option value="9">Media</option>
+                       </options>
+               </state>
        </channel-type>
        <channel-type id="centerrearseatheater" advanced="true">
                <item-type>Switch</item-type>