| shiftstate | String | Shift State | Indicates the state of the transmission, “P”, “D”, “R”, or “N” |
| sidemirrorheaters | Switch | Side Mirror Heaters | Indicates if the side mirror heaters are switched on |
| smartpreconditioning | Switch | Smart Preconditioning | Indicates if smart preconditioning is switched on |
+| softwareupdateavailable | Switch | Update Available | Car software update available, automatically generated on non-empty "update version" |
+| softwareupdatestatus | String | Update Status | Car software update status, e.g. "downloading_wifi_wait", "installing" |
+| softwareupdateversion | String | Update Version | Car software version to update to, e.g. "2023.32.9" or empty |
| soc | Number | State of Charge | State of Charge, in % |
| state | String | State | “online”, “asleep”, “waking” |
-| steeringwheelheater | Switch | Steering Wheel Heater | Turns On/Off the steering wheel heater |
+| 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. |
public static final String CHANNEL_COMBINED_TEMP = "combinedtemp";
public static final String CHANNEL_EVENTSTAMP = "eventstamp";
+ public static final String CHANNEL_SOFTWARE_UPDATE_AVAILABLE = "softwareupdateavailable";
+
// thing configurations
public static final String CONFIG_ALLOWWAKEUP = "allowWakeup";
public static final String CONFIG_ALLOWWAKEUPFORCOMMANDS = "allowWakeupForCommands";
}
},
SOC("soc", "soc", PercentType.class, false),
+ SOFTWARE_UPDATE_STATUS("status", "softwareupdatestatus", StringType.class, false),
+ SOFTWARE_UPDATE_VERSION("version", "softwareupdateversion", StringType.class, false),
SPEED("speed", "speed", DecimalType.class, false) {
@Override
public State getState(String s, TeslaChannelSelectorProxy proxy, Map<String, String> properties) {
import org.openhab.binding.tesla.internal.protocol.DriveState;
import org.openhab.binding.tesla.internal.protocol.Event;
import org.openhab.binding.tesla.internal.protocol.GUIState;
+import org.openhab.binding.tesla.internal.protocol.SoftwareUpdate;
import org.openhab.binding.tesla.internal.protocol.Vehicle;
import org.openhab.binding.tesla.internal.protocol.VehicleData;
import org.openhab.binding.tesla.internal.protocol.VehicleState;
protected VehicleState vehicleState;
protected ChargeState chargeState;
protected ClimateState climateState;
+ protected SoftwareUpdate softwareUpdate;
protected boolean allowWakeUp;
protected boolean allowWakeUpForCommands;
(climateState.driver_temp_setting + climateState.passenger_temp_setting) / 2.0f));
updateState(CHANNEL_COMBINED_TEMP, new QuantityType<>(avgtemp, SIUnits.CELSIUS));
+ softwareUpdate = vehicleState.software_update;
+
try {
lock.lock();
entrySet.addAll(gson.toJsonTree(vehicleState, VehicleState.class).getAsJsonObject().entrySet());
entrySet.addAll(gson.toJsonTree(chargeState, ChargeState.class).getAsJsonObject().entrySet());
entrySet.addAll(gson.toJsonTree(climateState, ClimateState.class).getAsJsonObject().entrySet());
+ entrySet.addAll(
+ gson.toJsonTree(softwareUpdate, SoftwareUpdate.class).getAsJsonObject().entrySet());
for (Map.Entry<String, JsonElement> entry : entrySet) {
try {
e.getMessage(), e);
}
}
+
+ if (softwareUpdate.version == null || softwareUpdate.version.isBlank()) {
+ updateState(CHANNEL_SOFTWARE_UPDATE_AVAILABLE, OnOffType.OFF);
+ } else {
+ updateState(CHANNEL_SOFTWARE_UPDATE_AVAILABLE, OnOffType.ON);
+ }
} finally {
lock.unlock();
}
--- /dev/null
+/**
+ * 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.tesla.internal.protocol;
+
+/**
+ * The {@link SoftwareUpdate} is a datastructure to capture
+ * variables sent by the Tesla Vehicle
+ *
+ * @author Hakan Tandogan - Initial contribution
+ */
+public class SoftwareUpdate {
+
+ public int download_perc;
+ public int expected_duration_sec;
+ public int install_perc;
+ public String status;
+ public String version;
+
+ SoftwareUpdate() {
+ }
+}
public String vehicle_name;
public String wheel_type;
+ public SoftwareUpdate software_update;
+
VehicleState() {
}
}
channel-type.tesla.smartpreconditioning.description = Indicates if smart preconditioning is switched on
channel-type.tesla.soc.label = State of Charge
channel-type.tesla.soc.description = State of Charge, in %
+channel-type.tesla.softwareupdateavailable.label = Update Available
+channel-type.tesla.softwareupdateavailable.description = Car software update available
+channel-type.tesla.softwareupdatestatus.label = Update Status
+channel-type.tesla.softwareupdatestatus.description = Car software update status
+channel-type.tesla.softwareupdateversion.label = Update Version
+channel-type.tesla.softwareupdateversion.description = Car software version to update to
channel-type.tesla.speed.label = Speed
channel-type.tesla.speed.description = Vehicle speed
channel-type.tesla.state.label = State
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
+ <channel-type id="softwareupdateavailable">
+ <item-type>Switch</item-type>
+ <label>Update Available</label>
+ <description>Car software update available</description>
+ <state readOnly="true"></state>
+ </channel-type>
+ <channel-type id="softwareupdatestatus">
+ <item-type>String</item-type>
+ <label>Update Status</label>
+ <description>Car software update status</description>
+ <state readOnly="true"></state>
+ </channel-type>
+ <channel-type id="softwareupdateversion">
+ <item-type>String</item-type>
+ <label>Update Version</label>
+ <description>Car software version to update to</description>
+ <state readOnly="true"></state>
+ </channel-type>
<channel-type id="destinationname">
<item-type>String</item-type>
<label>Route Destination</label>
<channel id="sidemirrorheaters" typeId="sidemirrorheaters"/>
<channel id="smartpreconditioning" typeId="smartpreconditioning"/>
<channel id="soc" typeId="soc"/>
+ <channel id="softwareupdateavailable" typeId="softwareupdateavailable"/>
+ <channel id="softwareupdatestatus" typeId="softwareupdatestatus"/>
+ <channel id="softwareupdateversion" typeId="softwareupdateversion"/>
<channel id="speed" typeId="speed"/>
<channel id="state" typeId="state"/>
<channel id="steeringwheelheater" typeId="steeringwheelheater"/>
</channels>
<properties>
- <property name="thingTypeVersion">1</property>
+ <property name="thingTypeVersion">2</property>
</properties>
<config-description>
<channel id="sidemirrorheaters" typeId="sidemirrorheaters"/>
<channel id="smartpreconditioning" typeId="smartpreconditioning"/>
<channel id="soc" typeId="soc"/>
+ <channel id="softwareupdateavailable" typeId="softwareupdateavailable"/>
+ <channel id="softwareupdatestatus" typeId="softwareupdatestatus"/>
+ <channel id="softwareupdateversion" typeId="softwareupdateversion"/>
<channel id="speed" typeId="speed"/>
<channel id="state" typeId="state"/>
<channel id="steeringwheelheater" typeId="steeringwheelheater"/>
</channels>
<properties>
- <property name="thingTypeVersion">1</property>
+ <property name="thingTypeVersion">2</property>
</properties>
<config-description>
<channel id="sidemirrorheaters" typeId="sidemirrorheaters"/>
<channel id="smartpreconditioning" typeId="smartpreconditioning"/>
<channel id="soc" typeId="soc"/>
+ <channel id="softwareupdateavailable" typeId="softwareupdateavailable"/>
+ <channel id="softwareupdatestatus" typeId="softwareupdatestatus"/>
+ <channel id="softwareupdateversion" typeId="softwareupdateversion"/>
<channel id="speed" typeId="speed"/>
<channel id="state" typeId="state"/>
<channel id="steeringwheelheater" typeId="steeringwheelheater"/>
</channels>
<properties>
- <property name="thingTypeVersion">1</property>
+ <property name="thingTypeVersion">2</property>
</properties>
<config-description>
<channel id="smartpreconditioning" typeId="smartpreconditioning"/>
<channel id="steeringwheelheater" typeId="steeringwheelheater"/>
<channel id="soc" typeId="soc"/>
+ <channel id="softwareupdateavailable" typeId="softwareupdateavailable"/>
+ <channel id="softwareupdatestatus" typeId="softwareupdatestatus"/>
+ <channel id="softwareupdateversion" typeId="softwareupdateversion"/>
<channel id="speed" typeId="speed"/>
<channel id="state" typeId="state"/>
<channel id="combinedtemp" typeId="combinedtemp"/>
</channels>
<properties>
- <property name="thingTypeVersion">1</property>
+ <property name="thingTypeVersion">2</property>
</properties>
<config-description>
<type>tesla:trafficminutesdelay</type>
</add-channel>
</instruction-set>
+
+ <instruction-set targetVersion="2">
+ <add-channel id="softwareupdateavailable" typeId="softwareupdateavailable">
+ <type>tesla:softwareupdateavailable</type>
+ </add-channel>
+ <add-channel id="softwareupdatestatus" typeId="softwareupdatestatus">
+ <type>tesla:softwareupdatestatus</type>
+ </add-channel>
+ <add-channel id="softwareupdateversion" typeId="softwareupdateversion">
+ <type>tesla:softwareupdateversion</type>
+ </add-channel>
+ </instruction-set>
</thing-type>
<thing-type uid="tesla:models">
<type>tesla:trafficminutesdelay</type>
</add-channel>
</instruction-set>
+
+ <instruction-set targetVersion="2">
+ <add-channel id="softwareupdateavailable" typeId="softwareupdateavailable">
+ <type>tesla:softwareupdateavailable</type>
+ </add-channel>
+ <add-channel id="softwareupdatestatus" typeId="softwareupdatestatus">
+ <type>tesla:softwareupdatestatus</type>
+ </add-channel>
+ <add-channel id="softwareupdateversion" typeId="softwareupdateversion">
+ <type>tesla:softwareupdateversion</type>
+ </add-channel>
+ </instruction-set>
</thing-type>
<thing-type uid="tesla:modelx">
<type>tesla:trafficminutesdelay</type>
</add-channel>
</instruction-set>
+
+ <instruction-set targetVersion="2">
+ <add-channel id="softwareupdateavailable" typeId="softwareupdateavailable">
+ <type>tesla:softwareupdateavailable</type>
+ </add-channel>
+ <add-channel id="softwareupdatestatus" typeId="softwareupdatestatus">
+ <type>tesla:softwareupdatestatus</type>
+ </add-channel>
+ <add-channel id="softwareupdateversion" typeId="softwareupdateversion">
+ <type>tesla:softwareupdateversion</type>
+ </add-channel>
+ </instruction-set>
</thing-type>
<thing-type uid="tesla:modely">
<type>tesla:trafficminutesdelay</type>
</add-channel>
</instruction-set>
+
+ <instruction-set targetVersion="2">
+ <add-channel id="softwareupdateavailable" typeId="softwareupdateavailable">
+ <type>tesla:softwareupdateavailable</type>
+ </add-channel>
+ <add-channel id="softwareupdatestatus" typeId="softwareupdatestatus">
+ <type>tesla:softwareupdatestatus</type>
+ </add-channel>
+ <add-channel id="softwareupdateversion" typeId="softwareupdateversion">
+ <type>tesla:softwareupdateversion</type>
+ </add-channel>
+ </instruction-set>
</thing-type>
</update:update-descriptions>