mirror of
https://github.com/danieldemus/openhab-addons
synced 2026-07-29 12:34:21 +02:00
[tesla] Add a new "share" channel for setting navigation destinations (#20144)
* Add a new "share" channel for setting navigation destinations Signed-off-by: Kai Kreuzer <kai@openhab.org>
This commit is contained in:
@@ -179,6 +179,7 @@ Additionally, these advanced channels are available (not all are available on al
|
||||
| scheduledchargingstart | DateTime | Scheduled Charging Start | Indicates when the scheduled charging session will start, in yyyy-MM-dd'T'HH:mm:ss format |
|
||||
| sentrymode | Switch | Sentry Mode | Activates or deactivates sentry mode |
|
||||
| sentrymodeavailable | Switch | Sentry Mode Available | Indicates whether sentry mode is currently available |
|
||||
| share | String | Share | Send an address to the vehicle's navigation system. Accepts: plain text addresses (e.g., "Eiffel Tower, Paris" or "Main St 1, 12345 Berlin"), Google Maps links, or coordinates (latitude,longitude) |
|
||||
| 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 |
|
||||
|
||||
+1
@@ -66,6 +66,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_SHARE = "share";
|
||||
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";
|
||||
|
||||
+1
@@ -911,6 +911,7 @@ public class TeslaChannelSelectorProxy {
|
||||
return super.getState(s);
|
||||
}
|
||||
},
|
||||
SHARE(null, "share", StringType.class, false),
|
||||
SHIFTSTATE("shift_state", "shiftstate", StringType.class, false),
|
||||
SIDEMIRROR_HEATING("side_mirror_heaters", "sidemirrorheaters", OnOffType.class, false) {
|
||||
@Override
|
||||
|
||||
+19
@@ -329,6 +329,12 @@ public class TeslaVehicleHandler extends BaseThingHandler {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SHARE: {
|
||||
if (command instanceof StringType) {
|
||||
shareAddress(command.toString());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SUN_ROOF_STATE: {
|
||||
if (command instanceof StringType) {
|
||||
setSunroof(command.toString());
|
||||
@@ -801,6 +807,19 @@ public class TeslaVehicleHandler extends BaseThingHandler {
|
||||
sendCommand(COMMAND_STEERING_WHEEL_HEATER, gson.toJson(payloadObject), account.commandTarget);
|
||||
}
|
||||
|
||||
public void shareAddress(String address) {
|
||||
JsonObject payloadObject = new JsonObject();
|
||||
payloadObject.addProperty("type", "share_ext_content_raw");
|
||||
payloadObject.addProperty("locale", "en-US");
|
||||
payloadObject.addProperty("timestamp_ms", String.valueOf(System.currentTimeMillis()));
|
||||
|
||||
JsonObject valueObject = new JsonObject();
|
||||
valueObject.addProperty("android.intent.extra.TEXT", address);
|
||||
payloadObject.add("value", valueObject);
|
||||
|
||||
sendCommand(COMMAND_SHARE, gson.toJson(payloadObject), account.commandTarget);
|
||||
}
|
||||
|
||||
protected @Nullable Vehicle queryVehicle() {
|
||||
String authHeader = account.getAuthHeader();
|
||||
|
||||
|
||||
@@ -314,6 +314,8 @@ channel-type.tesla.sentrymode.label = Sentry Mode
|
||||
channel-type.tesla.sentrymode.description = Activates or deactivates sentry mode
|
||||
channel-type.tesla.sentrymodeavailable.label = Sentry Available
|
||||
channel-type.tesla.sentrymodeavailable.description = Indicates whether sentry mode is currently available
|
||||
channel-type.tesla.share.label = Share
|
||||
channel-type.tesla.share.description = Send an address to the vehicle's navigation system
|
||||
channel-type.tesla.shiftstate.label = Shift State
|
||||
channel-type.tesla.shiftstate.description = Indicates the state of the transmission, “P”, “D”, “R”, or “N”
|
||||
channel-type.tesla.sidemirrorheaters.label = Side Mirror Heaters
|
||||
|
||||
@@ -682,6 +682,11 @@
|
||||
<description>Indicates whether sentry mode is currently available</description>
|
||||
<state readOnly="true"></state>
|
||||
</channel-type>
|
||||
<channel-type id="share" advanced="true">
|
||||
<item-type>String</item-type>
|
||||
<label>Share</label>
|
||||
<description>Send an address to the vehicle's navigation system</description>
|
||||
</channel-type>
|
||||
<channel-type id="shiftstate" advanced="true">
|
||||
<item-type>String</item-type>
|
||||
<label>Shift State</label>
|
||||
|
||||
@@ -108,6 +108,7 @@
|
||||
<channel id="scheduledchargingstart" typeId="scheduledchargingstart"/>
|
||||
<channel id="sentrymode" typeId="sentrymode"/>
|
||||
<channel id="sentrymodeavailable" typeId="sentrymodeavailable"/>
|
||||
<channel id="share" typeId="share"/>
|
||||
<channel id="shiftstate" typeId="shiftstate"/>
|
||||
<channel id="sidemirrorheaters" typeId="sidemirrorheaters"/>
|
||||
<channel id="smartpreconditioning" typeId="smartpreconditioning"/>
|
||||
@@ -129,7 +130,7 @@
|
||||
</channels>
|
||||
|
||||
<properties>
|
||||
<property name="thingTypeVersion">2</property>
|
||||
<property name="thingTypeVersion">3</property>
|
||||
</properties>
|
||||
|
||||
<config-description>
|
||||
|
||||
@@ -111,6 +111,7 @@
|
||||
<channel id="scheduledchargingstart" typeId="scheduledchargingstart"/>
|
||||
<channel id="sentrymode" typeId="sentrymode"/>
|
||||
<channel id="sentrymodeavailable" typeId="sentrymodeavailable"/>
|
||||
<channel id="share" typeId="share"/>
|
||||
<channel id="shiftstate" typeId="shiftstate"/>
|
||||
<channel id="sidemirrorheaters" typeId="sidemirrorheaters"/>
|
||||
<channel id="smartpreconditioning" typeId="smartpreconditioning"/>
|
||||
@@ -135,7 +136,7 @@
|
||||
</channels>
|
||||
|
||||
<properties>
|
||||
<property name="thingTypeVersion">2</property>
|
||||
<property name="thingTypeVersion">3</property>
|
||||
</properties>
|
||||
|
||||
<config-description>
|
||||
|
||||
@@ -111,6 +111,7 @@
|
||||
<channel id="scheduledchargingstart" typeId="scheduledchargingstart"/>
|
||||
<channel id="sentrymode" typeId="sentrymode"/>
|
||||
<channel id="sentrymodeavailable" typeId="sentrymodeavailable"/>
|
||||
<channel id="share" typeId="share"/>
|
||||
<channel id="shiftstate" typeId="shiftstate"/>
|
||||
<channel id="sidemirrorheaters" typeId="sidemirrorheaters"/>
|
||||
<channel id="smartpreconditioning" typeId="smartpreconditioning"/>
|
||||
@@ -135,7 +136,7 @@
|
||||
</channels>
|
||||
|
||||
<properties>
|
||||
<property name="thingTypeVersion">2</property>
|
||||
<property name="thingTypeVersion">3</property>
|
||||
</properties>
|
||||
|
||||
<config-description>
|
||||
|
||||
@@ -110,6 +110,7 @@
|
||||
<channel id="scheduledchargingstart" typeId="scheduledchargingstart"/>
|
||||
<channel id="sentrymode" typeId="sentrymode"/>
|
||||
<channel id="sentrymodeavailable" typeId="sentrymodeavailable"/>
|
||||
<channel id="share" typeId="share"/>
|
||||
<channel id="shiftstate" typeId="shiftstate"/>
|
||||
<channel id="sidemirrorheaters" typeId="sidemirrorheaters"/>
|
||||
<channel id="smartpreconditioning" typeId="smartpreconditioning"/>
|
||||
@@ -131,7 +132,7 @@
|
||||
</channels>
|
||||
|
||||
<properties>
|
||||
<property name="thingTypeVersion">2</property>
|
||||
<property name="thingTypeVersion">3</property>
|
||||
</properties>
|
||||
|
||||
<config-description>
|
||||
|
||||
@@ -33,6 +33,12 @@
|
||||
<type>tesla:softwareupdateversion</type>
|
||||
</add-channel>
|
||||
</instruction-set>
|
||||
|
||||
<instruction-set targetVersion="3">
|
||||
<add-channel id="share" typeId="share">
|
||||
<type>tesla:share</type>
|
||||
</add-channel>
|
||||
</instruction-set>
|
||||
</thing-type>
|
||||
|
||||
<thing-type uid="tesla:models">
|
||||
@@ -65,6 +71,12 @@
|
||||
<type>tesla:softwareupdateversion</type>
|
||||
</add-channel>
|
||||
</instruction-set>
|
||||
|
||||
<instruction-set targetVersion="3">
|
||||
<add-channel id="share" typeId="share">
|
||||
<type>tesla:share</type>
|
||||
</add-channel>
|
||||
</instruction-set>
|
||||
</thing-type>
|
||||
|
||||
<thing-type uid="tesla:modelx">
|
||||
@@ -97,6 +109,12 @@
|
||||
<type>tesla:softwareupdateversion</type>
|
||||
</add-channel>
|
||||
</instruction-set>
|
||||
|
||||
<instruction-set targetVersion="3">
|
||||
<add-channel id="share" typeId="share">
|
||||
<type>tesla:share</type>
|
||||
</add-channel>
|
||||
</instruction-set>
|
||||
</thing-type>
|
||||
|
||||
<thing-type uid="tesla:modely">
|
||||
@@ -129,5 +147,11 @@
|
||||
<type>tesla:softwareupdateversion</type>
|
||||
</add-channel>
|
||||
</instruction-set>
|
||||
|
||||
<instruction-set targetVersion="3">
|
||||
<add-channel id="share" typeId="share">
|
||||
<type>tesla:share</type>
|
||||
</add-channel>
|
||||
</instruction-set>
|
||||
</thing-type>
|
||||
</update:update-descriptions>
|
||||
|
||||
Reference in New Issue
Block a user