-
Notifications
You must be signed in to change notification settings - Fork 99
Opening (Venting) and Closing Windows via Custom API Call
InTheDaylight14 edited this page Dec 15, 2022
·
1 revision
As of version 3.1 a Window cover is available directly, the solution below is obsolete.
Service call to Vent:
- service: tesla_custom.api
data:
command: WINDOW_CONTROL
parameters:
path_vars:
vehicle_id: >-
{{ state_attr('binary_sensor.<vehicle_name>_online_sensor', 'id') }}
command: vent
lat: 0
long: 0
wake_if_asleep: true
Service call to Close:
- service: tesla_custom.api
data:
command: WINDOW_CONTROL
parameters:
path_vars:
vehicle_id: >-
{{ state_attr('binary_sensor.<vehicle_name>_online_sensor', 'id') }}
command: close
lat: 0
long: 0
wake_if_asleep: true
Template Cover (can also be a template switch). This looks at the front driver window to see if it is open or not. Then makes the appropriate api call to open or close.
cover:
- platform: template
covers:
<vehicle_name>_windows:
device_class: window
friendly_name: "<Vehicle Name> Windows"
value_template: >-
{% if state_attr('sensor.<vehicle_name>_vehicle_state_data_sensor','fd_window') %}
true
{%- else -%}
false
{%- endif %}
open_cover:
- service: tesla_custom.api
data:
command: WINDOW_CONTROL
parameters:
path_vars:
vehicle_id: >-
{{ state_attr('binary_sensor.<vehicle_name>_online_sensor', 'id') }}
command: vent
lat: 0
long: 0
wake_if_asleep: true
close_cover:
- service: tesla_custom.api
data:
command: WINDOW_CONTROL
parameters:
path_vars:
vehicle_id: >-
{{ state_attr('binary_sensor.<vehicle_name>_online_sensor', 'id') }}
command: close
lat: 0
long: 0
wake_if_asleep: true