Tesla heather on at 7:00

Hi Guys,

Just got the Tesla Model 3 and off course I have added this car into HA. Now I want to automate some bits and pieces for this car.

First off all I want to have the heater on at 7:00. I have read some things in this forum and found a automation part for the model X or so. Now I have changed some bits and pieces but error during testing.

#Tesla verwarming aan om 7.00
- alias: ‘Tesla verwarming’
  trigger:
  - at: 7:00
    platform: time
  condition
    condition: and
    conditions:
    - condition: numeric_state
      entity_id: sensor.sensor.tesla_model_3_5yj3e7eaxkf378212_battery_sensor
      above: 30
    - condition: numeric_state
      entity_id: sensor.sensor.tesla_model_3_5yj3e7eaxkf378212_temperature_sensor_outside
      below: 7
    - condition: state
      entity_id: device_tracker.tesla_model_3_5yj3e7eaxkf378212_location_tracker
      state: 'home'
    - condition: time
      weekday:
      - mon
      - tue
      - wed
      - thu
      - fri
   action:
     - service: climate.set_operation_mode
       data:
       entity_id: climate.tesla_model_3_5yj3e7eaxkf378212_hvac_climate_system
       operation_mode: 'on'

Who can help.

Cheers,

Remco

7:00 needs to be '07:00:00', condition needs to be condition:, and you need to correct the alignment of action: and everything below it.

Hi Tediore,

Should this be the right alignment?

#Tesla verwarming aan om 7.00
- alias: ‘Tesla verwarming’
  trigger:
  - at: 07:00:00
    platform: time
  condition:
    condition: and
    conditions:
    - condition: numeric_state
      entity_id: sensor.sensor.tesla_model_3_5yj3e7eaxkf378212_battery_sensor
      above: 30
    - condition: numeric_state
      entity_id: sensor.sensor.tesla_model_3_5yj3e7eaxkf378212_temperature_sensor_outside
      below: 7
    - condition: state
      entity_id: device_tracker.tesla_model_3_5yj3e7eaxkf378212_location_tracker
      state: 'home'
    - condition: time
      weekday:
      - mon
      - tue
      - wed
      - thu
      - fri
  action:
  - service: climate.set_operation_mode
     data:
     entity_id: climate.tesla_model_3_5yj3e7eaxkf378212_hvac_climate_system
     operation_mode: 'on'

This is the error I have now.

Error loading /home/homeassistant/.homeassistant/configuration.yaml: mapping values are not allowed here
in “/home/homeassistant/.homeassistant/automations.yaml”, line 125, column 10

Line 125 is the data: part.

This is a stab in the dark as I don’t have a Tesla and my KIA Soul EV is an older one and doesn’t have an App :frowning:

Also you could try
operation_mode: 'on'
instead of
operation_mode: 'heat'

    action:
      - service_template: climate.set_operation_mode
        data_template:
          entity_id: climate.tesla_model_3_5yj3e7eaxkf378212_hvac_climate_system
          operation_mode: 'heat'
      - service_template: climate.set_temperature
        entity_id: climate.tesla_model_3_5yj3e7eaxkf378212_hvac_climate_system
        data_template:
          temperature: 19

Or a simpler

     action:
      - service: climate.set_temperature
        entity_id: climate.tesla_model_3_5yj3e7eaxkf378212_hvac_climate_system
        data_template:
          temperature: 19

Try this:

  action:
  - service: climate.set_operation_mode
    data:
      entity_id: climate.tesla_model_3_5yj3e7eaxkf378212_hvac_climate_system
      operation_mode: heat

EDIT: Try again, my paste ruined the identation

Just add 2 spaces in front of entity_id and temperature after the data line. Everything that goes in the data section requires more indents that the data line itself

#Tesla verwarming aan om 7.00
- alias: ‘Tesla verwarming’
  trigger:
  - at: 07:00:00
    platform: time
  condition:
    condition: and
    conditions:
    - condition: numeric_state
      entity_id: sensor.sensor.tesla_model_3_5yj3e7eaxkf378212_battery_sensor
      above: 30
    - condition: numeric_state
      entity_id: sensor.sensor.tesla_model_3_5yj3e7eaxkf378212_temperature_sensor_outside
      below: 7
    - condition: state
      entity_id: device_tracker.tesla_model_3_5yj3e7eaxkf378212_location_tracker
      state: 'home'
    - condition: time
      weekday:
      - mon
      - tue
      - wed
      - thu
      - fri
  action:
  - service: climate.set_operation_mode
     data:
         entity_id: climate.tesla_model_3_5yj3e7eaxkf378212_hvac_climate_system
         operation_mode: heat

Error loading /home/homeassistant/.homeassistant/configuration.yaml: mapping values are not allowed here
in “/home/homeassistant/.homeassistant/automations.yaml”, line 27, column 10

#Tesla verwarming aan om 7.00
- alias: ‘Tesla verwarming’
  trigger:
  - at: 07:00:00
    platform: time
  condition:
    condition: and
    conditions:
    - condition: numeric_state
      entity_id: sensor.sensor.tesla_model_3_5yj3e7eaxkf378212_battery_sensor
      above: 30
    - condition: numeric_state
      entity_id: sensor.sensor.tesla_model_3_5yj3e7eaxkf378212_temperature_sensor_outside
      below: 7
    - condition: state
      entity_id: device_tracker.tesla_model_3_5yj3e7eaxkf378212_location_tracker
      state: 'home'
    - condition: time
      weekday:
      - mon
      - tue
      - wed
      - thu
      - fri
     action:
      - service: climate.set_temperature
        entity_id: climate.tesla_model_3_5yj3e7eaxkf378212_hvac_climate_system
        data_template:
          temperature: 19

Error loading /home/homeassistant/.homeassistant/configuration.yaml: while parsing a block mapping
in “/home/homeassistant/.homeassistant/automations.yaml”, line 7, column 5
expected , but found ‘’
in “/home/homeassistant/.homeassistant/automations.yaml”, line 25, column 6

Sorry @RemcovanKuilenburg my indentation was incorrect:

  action:
  - service: climate.set_operation_mode
    data:
      entity_id: climate.tesla_model_3_5yj3e7eaxkf378212_hvac_climate_system
      operation_mode: heat

@jgon I have the following.

#Tesla verwarming aan om 7.00
- alias: ‘Tesla verwarming’
  trigger:
  - at: 07:00:00
    platform: time
  condition:
    condition: and
    conditions:
    - condition: numeric_state
      entity_id: sensor.sensor.tesla_model_3_5yj3e7eaxkf378212_battery_sensor
      above: 30
    - condition: numeric_state
      entity_id: sensor.sensor.tesla_model_3_5yj3e7eaxkf378212_temperature_sensor_outside
      below: 7
    - condition: state
      entity_id: device_tracker.tesla_model_3_5yj3e7eaxkf378212_location_tracker
      state: 'home'
    - condition: time
      weekday:
      - mon
      - tue
      - wed
      - thu
      - fri
  action:
  - service: climate.set_operation_mode
    data:
      entity_id: climate.tesla_model_3_5yj3e7eaxkf378212_hvac_climate_system
      operation_mode: heat

And that gives me some errors.
I

nvalid config for [automation]: Entity ID sensor.sensor.tesla_model_3_5yj3e7eaxkf378212_battery_sensor is an invalid entity id for dictionary value @ data[‘condition’][0][‘conditions’][0][‘entity_id’]. Got None. (See /home/homeassistant/.homeassistant/configuration.yaml, line 79). Please check the docs at Automation - Home Assistant

Why are using twice “sensor.sensor”?

Try with:

sensor.tesla_model_3_5yj3e7eaxkf378212_temperature_sensor_outside

instead of:

sensor.sensor.tesla_model_3_5yj3e7eaxkf378212_temperature_sensor_outside
1 Like

Hey that is the one and now checking and it is working in the validation part. So vingers crossed after reboot.

Remove space in front of data

You don’t need the top and condition. By default the conditions are anded.

Remove lines

  condition: and
  conditions:

Gives me an error.

Error loading /home/homeassistant/.homeassistant/configuration.yaml: while parsing a block mapping
in “/home/homeassistant/.homeassistant/automations.yaml”, line 4, column 5
expected , but found ‘-’
in “/home/homeassistant/.homeassistant/automations.yaml”, line 6, column 5

#Tesla verwarming aan om 7.00
- alias: Tesla verwarming
  trigger:
    - at: "07:00:00"
      platform: time
  condition:
    - condition: numeric_state
      entity_id: sensor.tesla_model_3_5yj3e7eaxkf378212_battery_sensor
      above: 30
    - condition: numeric_state
      entity_id: sensor.tesla_model_3_5yj3e7eaxkf378212_temperature_sensor_outside
      below: 7
    - condition: state
      entity_id: device_tracker.tesla_model_3_5yj3e7eaxkf378212_location_tracker
      state: 'home'
    - condition: time
      weekday:
      - mon
      - tue
      - wed
      - thu
      - fri
  action:
    - service: climate.set_operation_mode
      data:
        entity_id: climate.tesla_model_3_5yj3e7eaxkf378212_hvac_climate_system
        operation_mode: heat

Cheers @petro I have it now in my automation and changed the temp and some words that should be in Dutch. So tomorrow morning we know :wink: