Hi, i want to create an automation that uses a Heat pump that turns on only specified hours every day (when i'm not home) and only if below let's say -1500W going to the power grid and turn off if the hours are outside of the specified range or the power going outside the grid is higher than -500W. I have created this template, but not sure how to set it up correctly so i ask some help if someone knows how to configure a more sophisticated automation like this. ```yaml
mode: single
triggers:
-
value_template: >-
{% set map = {1:'mon', 2:'tue', 3:'wed', 4:'thu', 5:'fri', 6:'sat',
7:'sun'} %}{% set schedule =
{'mon':'12:00','tue':'10:00','wed':'8:00','thu':'10:00','fri':'12:00'} %} %%%%turn ON time{% set dayofweek = map[now().isoweekday()] %}
{{ false if dayofweek not in schedule.keys() else now() >
today_at(schedule.get(dayofweek)) }}
trigger: template
{'mon':'17:00','tue':'16:30','wed':'19:00','thu':'16:00','fri':'14:00'} %} %%%%turn OFF time
conditions: -
condition: numeric_state
entity_id: sensor.power
below: -1500 -
condition: numeric_state
entity_id: sensor.power
above: -500
actions:
- device_id: ******
domain: climate
entity_id: *****
type: set_hvac_mode```