[tesla] Add steering wheel heater command support for Model 3/Y (#13704)

* Add steering wheel heater channel for Model Y
* Add command for steering wheel heater

Signed-off-by: Konstantin Polihronov <polychronov@gmail.com>
This commit is contained in:
Konstantin Polihronov 2022-11-14 22:33:21 +02:00 committed by GitHub
parent 0276d32897
commit 1471709b52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 22 additions and 6 deletions

View File

@ -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. |

View File

@ -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";

View File

@ -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);
}
}

View File

@ -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();

View File

@ -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

View File

@ -606,8 +606,8 @@
<channel-type id="steeringwheelheater" advanced="true">
<item-type>Switch</item-type>
<label>Steering Wheel Heater</label>
<description>Indicates if the steering wheel heater is switched on</description>
<state readOnly="true"></state>
<description>Turns On/Off the steering wheel heater</description>
<state readOnly="false"></state>
</channel-type>
<channel-type id="sunroofstate" advanced="true">
<item-type>String</item-type>

View File

@ -109,6 +109,7 @@
<channel id="soc" typeId="soc"/>
<channel id="speed" typeId="speed"/>
<channel id="state" typeId="state"/>
<channel id="steeringwheelheater" typeId="steeringwheelheater"/>
<channel id="combinedtemp" typeId="combinedtemp"/>
<channel id="timetofullcharge" typeId="timetofullcharge"/>
<channel id="tripcharging" typeId="tripcharging"/>

View File

@ -108,6 +108,7 @@
<channel id="shiftstate" typeId="shiftstate"/>
<channel id="sidemirrorheaters" typeId="sidemirrorheaters"/>
<channel id="smartpreconditioning" typeId="smartpreconditioning"/>
<channel id="steeringwheelheater" typeId="steeringwheelheater"/>
<channel id="soc" typeId="soc"/>
<channel id="speed" typeId="speed"/>
<channel id="state" typeId="state"/>