Use input_datetime helper to set ecobee.create_vacation

Im trying to set up an automation or script that Calls the ecobee.create_vacation that pulls the end date and end time from two input helpers ive created. image

no matter how try to use templates, it wont work… please help

We need to see the automation

alias: Set Vacation
description: “”
trigger: []
condition: []
action:

  • service: ecobee.create_vacation
    data:
    fan_mode: auto
    fan_min_on_time: 0
    entity_id: climate.downstairs
    vacation_name: Vacation
    start_date: ‘{{ (now().timestamp() | timestamp_custom("%Y-%m-%d")) }}’
    start_time: ‘{{ (now().timestamp() | timestamp_custom("%H:%M:%S")) }}’
    end_date: ‘{{states(“input_datetime.vacation_end_date”)| string}}’
    end_time: ‘{{states(“input_datetime.vacation_end_time”)| string}}’
    cool_temp: 80
    heat_temp: 55
    mode: single

Automations must have triggers… if you don’t have a trigger, or you plan to execute the action sequence via the dashboard, you need to set this up as a script.

I was planning on setting up the trigger later… right now im just using the run function to test it… but i cant seem to get it to work… it works fine if i use the UI editor with static date/time values… but i want to be able to control the time with an input helper

Post any error messages in Logs after executing the Run command.

Have you tested the service call with the templates in the Dev. Tools > Service tool?

FWIW, you can simplify it a little by using strftime() instead of converting to a timestamp then converting the timestamp to a string:

service: ecobee.create_vacation
data:
  fan_mode: auto
  fan_min_on_time: 0
  entity_id: climate.downstairs
  vacation_name: Vacation
  start_date: '{{ now().strftime("%Y-%m-%d") }}'
  start_time: '{{ now().strftime("%H:%M:%S") }}'
  end_date: '{{ states(“input_datetime.vacation_end_date”) }}'
  end_time: '{{ states(“input_datetime.vacation_end_time”) }}'
  cool_temp: 80
  heat_temp: 55

Is probably from the automation yaml

1 Like

I figured it out… I think it was the double quotes screwing me up… i fixed those by using the /"

service: ecobee.create_vacation data: fan_mode: auto fan_min_on_time: 0 entity_id: climate.upstairs vacation_name: Vacation start_date: "{{ (now().timestamp() | timestamp_custom(\"%Y-%m-%d\")) }}" start_time: "{{ (now().timestamp() | timestamp_custom(\"%H:%M:%S\")) }}" end_date: "{{(states(\"input_datetime.vacation_end_date\")| string)}}" end_time: "{{(states(\"input_datetime.vacation_end_time\")| string)}}" cool_temp: 80 heat_temp: 55