I was wondering if someone could help me create an automation that will turn my A/c on a specific temp and run for 3:30 hours @1am after i click a button in lovelace. then the button will reset to off at 5am
I am hoping when i click the switch it will turn on the automation to run at the time shown, then when the automation is done it will turn the switch back to off.
If anyone else can help that would be awesome.
PS I dont think i need the AC timer cause it is not in my automation
Since you have used an Input datetime helper instead of a static time, it seems like you want to be able to adjust to start time. Does the off-time need to be 3.5 hours after the start or at 5am?
For a dynamic off-time, you can use a template trigger to calculate the desired time:
For a static 5am off-time, you can use a second Time trigger:
- platform: time
at: "05:00:00"
id: Off
While you can disable and enable automations as you have in your dashboard card, it is generally better to design your automations with conditions so that you don’t need to do that. In your case, you could use an Input boolean helper as part of the conditions of your automation. (In the example below I have used input_boolean.run_ac_tonight)
Once you decide on the off-time and have created the input boolean helper, you can use an automation like the following:
alias: Run A/C tonight
description: ''
trigger:
- platform: time
at: input_datetime.a_c_date_and_time
id: On
- platform: ** SEE ABOVE **
id: Off
condition: []
action:
- choose:
- conditions:
- condition: trigger
id: On
- condition: state
entity_id: input_boolean.run_ac_tonight
state: 'on'
sequence:
- service: climate.set_temperature
data:
temperature: 64
hvac_mode: cool
target:
entity_id: climate.kitchen
- conditions:
- condition: trigger
id: Off
sequence:
- service: climate.turn_off
target:
entity_id: climate.kitchen
- service: input_boolean.turn_off
target:
entity_id: input_boolean.run_ac_tonight
default: []
I want the time that it runs to be static. it needs to start at 1am. It always needs to be on for 3:30 hours. there will never be anytime that the time it starts needs to be adjusted.
There is no need for an Input button helper… and, as it stands, it isn’t linked to the Input boolean that was suggested. If you just want to use the Input button, you will need to have an automation to toggle the boolean when the button is pressed.
I think the source of the confusion is a misunderstanding of what a button helper actually is. The Input Button helper integration allows you to define buttons that can be pressed via the user interface, and can be used to trigger things, like an automation. But, they do not “turn on” or “turn off”…
Input booleans/toggles turn on and off. They can be switched on and off in the user interface. That is why I have suggested you use an Input boolean helper. You can create Input boolean helpers in the helper editor under the heading Toggle.
Steps to accomplish what has been discussed:
Create an Input boolean (see link above) called input_boolean.run_ac_tonight
You are correct, I forgot we had removed the Input datetime helper from the automation.
If your kitchen thermostat controls both AC and Heating, one thing to think about for the future is what conditions might be needed to prevent this automation from turning off the heat in the middle of the night. For example:
Different thermostats may post the mode information to different attributes. My thermostat posts the mode to both the state and the hvac_action, others post it to hvac_modes. Just substitute the correct attribute or sensor name and value into the the condition… for example if your thermostat uses hvac_action you would use: