Climate - how to turn on only at specific time?

My code:

climate:
  platform: generic_thermostat
  name: Salon
  heater: switch.gsalon
  target_sensor: sensor.netatmo_parter_temperature
  min_temp: 28
  max_temp: 30
  target_temp: 30
  min_cycle_duration:
     seconds: 3


automation:
  - alias: Grzejnik salon on
    trigger:
      platform: time
      after: "17:08:00"
    action:
    - service: climate.set_operation_mode
      data:
        entity_id: climate.salon
        operation_mode: Heat

I want turn on thermostat after specific time and tur it off on another time. Above automation doesn’t works :frowning:

Log Error:

ERROR:homeassistant.core:BusHandler:Exception doing job
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/homeassistant/core.py", line 1224, in job_handler
    func(*args)
  File "/usr/local/lib/python3.4/dist-packages/homeassistant/core.py", line 1087, in execute_service
    service_handler.func(service_call)
  File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/climate/__init__.py", line 329, in operation_set_service
    climate.set_operation_mode(operation_mode)
  File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/climate/__init__.py", line 512, in set_operation_mode
    raise NotImplementedError()
NotImplementedError

You can use climate.set_temperature

- service: climate.set_temperature
  data_template:
    entity_id: "climate.salon"
    temperature: '{{ float(states.input_slider.auto_temp.state) }}'

I don’t understand this. I want this:

Turn on heater between 13:00 and 15:00 only when temperature is below 23, turn it off when temperature is above 25. I can do this in this way:

automation:
  - alias: Turn on heater in living room
    trigger:
      platform: time
      seconds: '/1'
    condition:
      condition: and
      conditions:
        - condition: numeric_state
          entity_id: sensor.netatmo_parter_temperature
          below: 23
        - condition: time
          after: '13:00:00'
          before: '15:00:00'
    action:
    - service: switch.turn_on
      entity_id: switch.gsalon

  - alias: Turn off heater in living room
    trigger:
      platform: time
      seconds: '/1'
    condition:
      condition: and
      conditions:
        - condition: numeric_state
          entity_id: sensor.netatmo_parter_temperature
          above: 25
        - condition: time
          after: '13:00:00'
          before: '15:00:00'
    action:
    - service: switch.turn_off
      entity_id: switch.gsalon

Someone told me that climate method will be simplier. But id does not :frowning:
I’m new here. Domoticz has this very simple, HA not.

So doing it with climate, as Danielhiversen mentioned, you can use climate.set_temperature, so that the “thermostat” has a low target temperature when you don’t want the heater on, and a high (i.e. > 23) temperature when you do. My automation looks like this:

automation:
  - alias: Reduce the target temperature overnight
    initial_state: True
    hide_entity: False
    trigger:
      platform: time
      minutes: 50
      seconds: 0
    condition:
      condition: time
      after: '21:45:00'
      before: '06:00:00'
    action:
      service: climate.set_temperature
      data:
        entity_id: climate.heating
        temperature: 14

  - alias: Reset the target temperature
    initial_state: True
    hide_entity: True
    trigger:
      platform: time
      after: '06:00:00'
    action:
      service: climate.set_temperature
      data:
        entity_id: climate.heating
        temperature: 20.5

hope that is clearer. But i agree it’s not much simpler :slight_smile:

Thanks. Not simplier, but more clearly to me :wink:

By using the climate component you can also change the target temperature in the frontend.

(I think you should go back to Domoticz, since you in every post say that Domoticz is much better :confused: )

It’s bad that I have some experience? Domoticz has better support and documentation, here simple things are more complicated because of coding everything. But it’s good when flexibility is needed. That’s why I’m here.

1 Like

I have a similar use case, so check this out (i think this is what Danielhiversen suggested):

- alias: Wake up
  initial_state: True
  hide_entity: False
  trigger:
    platform: time
    after: '06:30:00'
  condition:
    condition: time
    weekday:
      - mon
      - tue
      - wed
      - thu
      - fri
  action:
    - service: climate.set_temperature
      data:
        temperature: 22
        operation_mode: Heat

- alias: Go to work
  initial_state: True
  hide_entity: False
  trigger:
    platform: time
    after: '07:30:00'
  condition:
    condition: time
    weekday:
      - mon
      - tue
      - wed
      - thu
      - fri
  action:
    - service: climate.set_temperature
      data:
        temperature: 17
        operation_mode: Heat

Hi,
Im setting up virtually the same, has something changed with platform: time?
Im using hassbian latest and getting platform: time not supported.

Thanks

In the current version of HA the time trigger uses at: rather than after:

Thanks very much

Most welcome

I’ve found (in the generic thermostat module), that setting operation_mode in the set_temperature service call, does not do anything to the operation_mode (possibly a bug or incorect documentation) I ended up doing a separate call:

  • service: climate.set_temperature
    data:
    entity_id:
    - climate.bedroom1
    - climate.bedroom2
    temperature: 18

  • service: climate.set_operation_mode
    data:
    entity_id:
    - climate.bedroom1
    - climate.bedroom2
    operation_mode: heat

2 Likes

With a presence detection you can automate the climate. If person X is at home then turn on climate to temp X. You can do this between a specific time period. The same to turn of the climate when person X is not home and on a specific time.
Turn on temp:
alias: Toon - inschakelen
description: ‘’
trigger:

  • at: 08:16:00
    platform: time
    condition:
  • after: 08:15:00
    before: ‘21:15:00’
    condition: time
  • condition: state
    entity_id: group.allpersons
    state: home
    action:
  • data:
    entity_id: climate.toon_thermostat
    hvac_mode: heat_cool
    temperature: 20
    service: climate.set_temperature

and turn off temp:
alias: Toon - uitschakelen
description: ‘’
trigger:

  • entity_id: group.allpersons
    platform: state
    to: not_home
  • at: ‘21:31:00’
    platform: time
    condition: []
    action:
  • data:
    entity_id: climate.toon_thermostat
    hvac_mode: heat_cool
    temperature: 15
    service: climate.set_temperature

I am in now way affiliated with this person. I say this because I’ve posted this in a few topics. This add-on is ideal because you can set up a schedule to assign a specific temperature whenever you want. You can use an automation to turn the schedule on/off based on your conditions. Might be worth a look