| Channel ID | Item Type | Label | Description |
|---------------------------|--------------------------|-------------------------------|------------------------------------------------------------------------------------------------------------------|
+| destinationname | String | Route destination | Name of the destination |
+| destinationlocation | Location | Route location | Location of the destination |
+| distancetoarrival | Number:Length | Distance to arrival | Distance to drive to the destination (in miles) |
+| minutestoarrival | Number:Time | Minutes to arrival | Minutes to drive to the destination |
+| trafficminutesdelay | Number:Time | Traffic delay | Minutes of delay due to traffic |
| autoparkstate | String | Autopark State | Undocumented / To be defined |
| autoparkstyle | String | Autopark Style | Undocumented / To be defined |
| batterycurrent | Number:ElectricCurrent | Battery Current | Current (Ampere) floating into (+) or out (-) of the battery |
Bridge tesla:account:myaccount "My Tesla Account" [ refreshToken="xxxx" ] {
model3 mycar "My favorite car" [ vin="5YJSA7H25FFP53736"]
}
-```
demo.items:
Number:Temperature TeslaTemperatureCombined {channel="account:model3:myaccount:mycar:combinedtemp"}
Number:Temperature TeslaInsideTemperature {channel="account:model3:myaccount:mycar:insidetemp"}
Number:Temperature TeslaOutsideTemperature {channel="account:model3:myaccount:mycar:outsidetemp"}
+
+String TeslaDestinationName {channel="account:model3:myaccount:mycar:destinationname"}
+Location TeslaDestinationLocation {channel="account:model3:myaccount:mycar:destinationlocation"}
+Number:Time TeslaMinutesToArrival {channel="account:model3:myaccount:mycar:minutestoarrival", unit="min"}
+Number:Length TeslaDistanceToArrival {channel="account:model3:myaccount:mycar:distancetoarrival"}
```
demo.sitemap:
{
Mapview item=TeslaLocation height=10
}
+ Frame
+ {
+ Default item=TeslaDestinationName
+ Default item=TeslaMinutesToArrival
+ Default item=TeslaDistanceToArrival
+ Mapview item=TeslaDestinationLocation height=10
+ }
}
}
```
public enum TeslaChannelSelector {
API("api_version", "api", DecimalType.class, true),
+ AR_DESTINATION("active_route_destination", "destinationname", StringType.class, false),
+ AR_LATITUDE("active_route_latitude", "destinationlocation", DecimalType.class, false) {
+ @Override
+ public State getState(String s, TeslaChannelSelectorProxy proxy, Map<String, String> properties) {
+ proxy.latitude = s;
+ return new PointType(new StringType(proxy.latitude), new StringType(proxy.longitude),
+ new StringType(proxy.elevation));
+ }
+ },
+ AR_LONGITUDE("active_route_longitude", "destinationlocation", DecimalType.class, false) {
+ @Override
+ public State getState(String s, TeslaChannelSelectorProxy proxy, Map<String, String> properties) {
+ proxy.longitude = s;
+ return new PointType(new StringType(proxy.latitude), new StringType(proxy.longitude),
+ new StringType(proxy.elevation));
+ }
+ },
+ AR_DISTANCE_TO_ARRIVAL("active_route_miles_to_arrival", "distancetoarrival", DecimalType.class, false) {
+ @Override
+ public State getState(String s, TeslaChannelSelectorProxy proxy, Map<String, String> properties) {
+ State someState = super.getState(s);
+ BigDecimal value = ((DecimalType) someState).toBigDecimal();
+ return new QuantityType<>(value, ImperialUnits.MILE);
+ }
+ },
+ AR_MINUTES_TO_ARRIVAL("active_route_minutes_to_arrival", "minutestoarrival", DecimalType.class, false) {
+ @Override
+ public State getState(String s, TeslaChannelSelectorProxy proxy, Map<String, String> properties) {
+ State someState = super.getState(s);
+ BigDecimal value = ((DecimalType) someState).toBigDecimal();
+ return new QuantityType<>(value, Units.MINUTE);
+ }
+ },
+ AR_TRAFFIC_MINUTES_DELAY("active_route_traffic_minutes_delay", "trafficminutesdelay", DecimalType.class,
+ false) {
+ @Override
+ public State getState(String s, TeslaChannelSelectorProxy proxy, Map<String, String> properties) {
+ State someState = super.getState(s);
+ BigDecimal value = ((DecimalType) someState).toBigDecimal();
+ return new QuantityType<>(value, Units.MINUTE);
+ }
+ },
AUTO_COND("is_auto_conditioning_on", "autoconditioning", OnOffType.class, false) {
@Override
public State getState(String s, TeslaChannelSelectorProxy proxy, Map<String, String> properties) {
*/
public class DriveState {
+ public String active_route_destination;
+ public double active_route_latitude;
+ public double active_route_longitude;
+ public double active_route_miles_to_arrival;
+ public double active_route_minutes_to_arrival;
+ public double active_route_traffic_minutes_delay;
public double latitude;
public double longitude;
public double native_latitude;
# channel types
+channel-type.tesla.destinationname.label = Route Destination
+channel-type.tesla.destinationname.description = Name of the destination
+channel-type.tesla.destinationlocation.label = Route Location
+channel-type.tesla.destinationlocation.description = Location of the destination
+channel-type.tesla.distancetoarrival.label = Distance To Arrival
+channel-type.tesla.distancetoarrival.description = Distance to drive to the destination (in miles)
+channel-type.tesla.minutestoarrival.label = Minutes To Arrival
+channel-type.tesla.minutestoarrival.description = Minutes to drive to the destination
+channel-type.tesla.trafficminutesdelay.label = Traffic Delay
+channel-type.tesla.trafficminutesdelay.description = Delay to arrive at the destination due to traffic
+
channel-type.tesla.autoconditioning.label = Auto Conditioning
channel-type.tesla.autoconditioning.description = Turns on auto-conditioning (a/c or heating)
channel-type.tesla.autoparkstate.label = Autopark 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="destinationname">
+ <item-type>String</item-type>
+ <label>Route Destination</label>
+ <description>Name of the destination</description>
+ <state readOnly="true"></state>
+ </channel-type>
+ <channel-type id="destinationlocation" advanced="false">
+ <item-type>Location</item-type>
+ <label>Route Location</label>
+ <description>Location of the destination</description>
+ <state readOnly="true"></state>
+ </channel-type>
+ <channel-type id="distancetoarrival">
+ <item-type>Number:Length</item-type>
+ <label>Distance To Arrival</label>
+ <description>Distance to drive to the destination (in miles)</description>
+ <state pattern="%.1f %unit%" readOnly="true"></state>
+ </channel-type>
+ <channel-type id="minutestoarrival">
+ <item-type>Number:Time</item-type>
+ <label>Minutes To Arrival</label>
+ <description>Minutes to drive to the destination</description>
+ <category>Time</category>
+ <state pattern="%d %unit%" readOnly="true"></state>
+ </channel-type>
+ <channel-type id="trafficminutesdelay">
+ <item-type>Number:Time</item-type>
+ <label>Traffic Delay</label>
+ <description>Delay to arrive at the destination due to traffic</description>
+ <category>Time</category>
+ <state pattern="%d %unit%" readOnly="true"></state>
+ </channel-type>
+
<channel-type id="autoconditioning">
<item-type>Switch</item-type>
<label>Auto Conditioning</label>
<description>A Tesla Model 3 Vehicle</description>
<channels>
+ <channel id="destinationname" typeId="destinationname"/>
+ <channel id="destinationlocation" typeId="destinationlocation"/>
+ <channel id="distancetoarrival" typeId="distancetoarrival"/>
+ <channel id="minutestoarrival" typeId="minutestoarrival"/>
+ <channel id="trafficminutesdelay" typeId="trafficminutesdelay"/>
<channel id="autoconditioning" typeId="autoconditioning"/>
<channel id="autoparkstate" typeId="autoparkstate"/>
<channel id="autoparkstate2" typeId="autoparkstate"/>
<channel id="wakeup" typeId="wakeup"/>
</channels>
+ <properties>
+ <property name="thingTypeVersion">1</property>
+ </properties>
+
<config-description>
<parameter name="vin" type="text" required="true">
<label>Vehicle Identification Number</label>
<description>A Tesla Model S Vehicle</description>
<channels>
+ <channel id="destinationname" typeId="destinationname"/>
+ <channel id="destinationlocation" typeId="destinationlocation"/>
+ <channel id="distancetoarrival" typeId="distancetoarrival"/>
+ <channel id="minutestoarrival" typeId="minutestoarrival"/>
+ <channel id="trafficminutesdelay" typeId="trafficminutesdelay"/>
<channel id="autoconditioning" typeId="autoconditioning"/>
<channel id="autoparkstate" typeId="autoparkstate"/>
<channel id="autoparkstate2" typeId="autoparkstate"/>
<channel id="wiperbladeheater" typeId="wiperbladeheater"/>
</channels>
+ <properties>
+ <property name="thingTypeVersion">1</property>
+ </properties>
+
<config-description>
<parameter name="vin" type="text" required="true">
<label>Vehicle Identification Number</label>
<description>A Tesla Model X Vehicle</description>
<channels>
+ <channel id="destinationname" typeId="destinationname"/>
+ <channel id="destinationlocation" typeId="destinationlocation"/>
+ <channel id="distancetoarrival" typeId="distancetoarrival"/>
+ <channel id="minutestoarrival" typeId="minutestoarrival"/>
+ <channel id="trafficminutesdelay" typeId="trafficminutesdelay"/>
<channel id="autoconditioning" typeId="autoconditioning"/>
<channel id="autoparkstate" typeId="autoparkstate"/>
<channel id="autoparkstate2" typeId="autoparkstate"/>
<channel id="wiperbladeheater" typeId="wiperbladeheater"/>
</channels>
+ <properties>
+ <property name="thingTypeVersion">1</property>
+ </properties>
+
<config-description>
<parameter name="vin" type="text" required="true">
<label>Vehicle Identification Number</label>
<description>A Tesla Model Y Vehicle</description>
<channels>
+ <channel id="destinationname" typeId="destinationname"/>
+ <channel id="destinationlocation" typeId="destinationlocation"/>
+ <channel id="distancetoarrival" typeId="distancetoarrival"/>
+ <channel id="minutestoarrival" typeId="minutestoarrival"/>
+ <channel id="trafficminutesdelay" typeId="trafficminutesdelay"/>
<channel id="allowwakeup" typeId="allowwakeup"/>
<channel id="autoconditioning" typeId="autoconditioning"/>
<channel id="autoparkstate" typeId="autoparkstate"/>
<channel id="wakeup" typeId="wakeup"/>
</channels>
+ <properties>
+ <property name="thingTypeVersion">1</property>
+ </properties>
+
<config-description>
<parameter name="vin" type="text" required="true">
<label>Vehicle Identification Number</label>
--- /dev/null
+<?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="tesla:model3">
+ <instruction-set targetVersion="1">
+ <add-channel id="destinationname">
+ <type>tesla:destinationname</type>
+ </add-channel>
+ <add-channel id="destinationlocation">
+ <type>tesla:destinationlocation</type>
+ </add-channel>
+ <add-channel id="distancetoarrival">
+ <type>tesla:distancetoarrival</type>
+ </add-channel>
+ <add-channel id="minutestoarrival">
+ <type>tesla:minutestoarrival</type>
+ </add-channel>
+ <add-channel id="trafficminutesdelay">
+ <type>tesla:trafficminutesdelay</type>
+ </add-channel>
+ </instruction-set>
+ </thing-type>
+
+ <thing-type uid="tesla:models">
+ <instruction-set targetVersion="1">
+ <add-channel id="destinationname">
+ <type>tesla:destinationname</type>
+ </add-channel>
+ <add-channel id="destinationlocation">
+ <type>tesla:destinationlocation</type>
+ </add-channel>
+ <add-channel id="distancetoarrival">
+ <type>tesla:distancetoarrival</type>
+ </add-channel>
+ <add-channel id="minutestoarrival">
+ <type>tesla:minutestoarrival</type>
+ </add-channel>
+ <add-channel id="trafficminutesdelay">
+ <type>tesla:trafficminutesdelay</type>
+ </add-channel>
+ </instruction-set>
+ </thing-type>
+
+ <thing-type uid="tesla:modelx">
+ <instruction-set targetVersion="1">
+ <add-channel id="destinationname">
+ <type>tesla:destinationname</type>
+ </add-channel>
+ <add-channel id="destinationlocation">
+ <type>tesla:destinationlocation</type>
+ </add-channel>
+ <add-channel id="distancetoarrival">
+ <type>tesla:distancetoarrival</type>
+ </add-channel>
+ <add-channel id="minutestoarrival">
+ <type>tesla:minutestoarrival</type>
+ </add-channel>
+ <add-channel id="trafficminutesdelay">
+ <type>tesla:trafficminutesdelay</type>
+ </add-channel>
+ </instruction-set>
+ </thing-type>
+
+ <thing-type uid="tesla:modely">
+ <instruction-set targetVersion="1">
+ <add-channel id="destinationname">
+ <type>tesla:destinationname</type>
+ </add-channel>
+ <add-channel id="destinationlocation">
+ <type>tesla:destinationlocation</type>
+ </add-channel>
+ <add-channel id="distancetoarrival">
+ <type>tesla:distancetoarrival</type>
+ </add-channel>
+ <add-channel id="minutestoarrival">
+ <type>tesla:minutestoarrival</type>
+ </add-channel>
+ <add-channel id="trafficminutesdelay">
+ <type>tesla:trafficminutesdelay</type>
+ </add-channel>
+ </instruction-set>
+ </thing-type>
+</update:update-descriptions>