diff --git a/bundles/org.openhab.binding.tesla/README.md b/bundles/org.openhab.binding.tesla/README.md index d09b47ae852..85ba3310965 100644 --- a/bundles/org.openhab.binding.tesla/README.md +++ b/bundles/org.openhab.binding.tesla/README.md @@ -182,7 +182,7 @@ Additionally, these advanced channels are available (not all are available on al | smartpreconditioning | Switch | Smart Preconditioning | Indicates if smart preconditioning is switched on | | soc | Number | State of Charge | State of Charge, in % | | state | String | State | “online”, “asleep”, “waking” | -| steeringwheelheater | Switch | Steering Wheel Heater | Indicates if the steering wheel heater is switched on | +| steeringwheelheater | Switch | Steering Wheel Heater | Turns On/Off the steering wheel heater | | sunroofstate | String | Sunroof State | Valid states are “unknown”, “open”, “closed”, “vent”, “comfort”. Accepts commands "close" and "vent". | | sunroof | Dimmer | Sunroof | Indicates the opening state of the sunroof (0% closed, 100% fully open) | | temperature | Number:Temperature | Temperature | Set the temperature of the autoconditioning system. The temperature for the driver and passenger will be synced. | diff --git a/bundles/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/TeslaBindingConstants.java b/bundles/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/TeslaBindingConstants.java index 372c0c2969c..f75638e0cc8 100644 --- a/bundles/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/TeslaBindingConstants.java +++ b/bundles/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/TeslaBindingConstants.java @@ -65,6 +65,7 @@ public class TeslaBindingConstants { public static final String COMMAND_SET_SENTRY_MODE = "set_sentry_mode"; public static final String COMMAND_SET_TEMP = "set_temps"; public static final String COMMAND_SET_VALET_MODE = "set_valet_mode"; + public static final String COMMAND_STEERING_WHEEL_HEATER = "remote_steering_wheel_heater_request"; public static final String COMMAND_SUN_ROOF = "sun_roof_control"; public static final String COMMAND_THROTTLE = "commandthrottle"; public static final String COMMAND_WAKE_UP = "wake_up"; diff --git a/bundles/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/TeslaChannelSelectorProxy.java b/bundles/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/TeslaChannelSelectorProxy.java index ede61d1767c..7d76154d4be 100644 --- a/bundles/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/TeslaChannelSelectorProxy.java +++ b/bundles/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/TeslaChannelSelectorProxy.java @@ -1076,7 +1076,7 @@ public class TeslaChannelSelectorProxy { } } - throw new IllegalArgumentException("Not valid value selector"); + throw new IllegalArgumentException("Not valid value selector. Received Selector: " + valueSelectorText); } public static TeslaChannelSelector getValueSelectorFromRESTID(String valueSelectorText) @@ -1087,7 +1087,7 @@ public class TeslaChannelSelectorProxy { } } - throw new IllegalArgumentException("Not valid value selector"); + throw new IllegalArgumentException("Not valid value selector. Received Selector: " + valueSelectorText); } } diff --git a/bundles/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/handler/TeslaVehicleHandler.java b/bundles/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/handler/TeslaVehicleHandler.java index 8053d47ae1d..fff168e5051 100644 --- a/bundles/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/handler/TeslaVehicleHandler.java +++ b/bundles/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/handler/TeslaVehicleHandler.java @@ -448,6 +448,13 @@ public class TeslaVehicleHandler extends BaseThingHandler { } break; } + case STEERINGWHEEL_HEATER: { + if (command instanceof OnOffType) { + boolean commandBooleanValue = ((OnOffType) command) == OnOffType.ON ? true : false; + setSteeringWheelHeater(commandBooleanValue); + } + break; + } default: break; } @@ -799,6 +806,12 @@ public class TeslaVehicleHandler extends BaseThingHandler { sendCommand(COMMAND_WAKE_UP, account.wakeUpTarget); } + public void setSteeringWheelHeater(boolean isOn) { + JsonObject payloadObject = new JsonObject(); + payloadObject.addProperty("on", isOn); + sendCommand(COMMAND_STEERING_WHEEL_HEATER, gson.toJson(payloadObject), account.commandTarget); + } + protected Vehicle queryVehicle() { String authHeader = account.getAuthHeader(); diff --git a/bundles/org.openhab.binding.tesla/src/main/resources/OH-INF/i18n/tesla.properties b/bundles/org.openhab.binding.tesla/src/main/resources/OH-INF/i18n/tesla.properties index 2d33187b2c4..3dd21b33858 100644 --- a/bundles/org.openhab.binding.tesla/src/main/resources/OH-INF/i18n/tesla.properties +++ b/bundles/org.openhab.binding.tesla/src/main/resources/OH-INF/i18n/tesla.properties @@ -269,7 +269,7 @@ channel-type.tesla.speed.description = Vehicle speed channel-type.tesla.state.label = State channel-type.tesla.state.description = “online”, “asleep”, “waking” channel-type.tesla.steeringwheelheater.label = Steering Wheel Heater -channel-type.tesla.steeringwheelheater.description = Indicates if the steering wheel heater is switched on +channel-type.tesla.steeringwheelheater.description = Turns On/Off the steering wheel heater channel-type.tesla.sunroof.label = Sunroof channel-type.tesla.sunroof.description = Indicates the opening state of the sunroof (0% closed, 100% fully open) channel-type.tesla.sunroofstate.label = Sunroof State diff --git a/bundles/org.openhab.binding.tesla/src/main/resources/OH-INF/thing/channels.xml b/bundles/org.openhab.binding.tesla/src/main/resources/OH-INF/thing/channels.xml index f9ab8be21cd..1d092f763f1 100644 --- a/bundles/org.openhab.binding.tesla/src/main/resources/OH-INF/thing/channels.xml +++ b/bundles/org.openhab.binding.tesla/src/main/resources/OH-INF/thing/channels.xml @@ -606,8 +606,8 @@ Switch - Indicates if the steering wheel heater is switched on - + Turns On/Off the steering wheel heater + String diff --git a/bundles/org.openhab.binding.tesla/src/main/resources/OH-INF/thing/model3.xml b/bundles/org.openhab.binding.tesla/src/main/resources/OH-INF/thing/model3.xml index 50d9a626aa8..fdd9b5c4ad2 100644 --- a/bundles/org.openhab.binding.tesla/src/main/resources/OH-INF/thing/model3.xml +++ b/bundles/org.openhab.binding.tesla/src/main/resources/OH-INF/thing/model3.xml @@ -109,6 +109,7 @@ + diff --git a/bundles/org.openhab.binding.tesla/src/main/resources/OH-INF/thing/modely.xml b/bundles/org.openhab.binding.tesla/src/main/resources/OH-INF/thing/modely.xml index 4aa802eff67..46fb050f364 100644 --- a/bundles/org.openhab.binding.tesla/src/main/resources/OH-INF/thing/modely.xml +++ b/bundles/org.openhab.binding.tesla/src/main/resources/OH-INF/thing/modely.xml @@ -108,6 +108,7 @@ +