Help automation for turning on heating (at night certain behaviour) at day other behaviour

I have floor heating and electric heater and wish to have a balanced temperature.

Basically turn on the heater, wait until a certain temperature is reached, then turned it off, when is cooled at a certain temperature turn the heater on again. ALso at night it should stay all off (regardless of temperature, only if temperature goes below a very low temperature).

Of course I have a temperature semsor.

Can you please help me achieve this?

I suggest using the Generic Thermostat integration and then use the Schedule integration to specify the operating schedule. Use an automation to tie the two together.

thanks, generic thermostat is of great help. But scheduler? I mean at night an automation should also check the temperatures, just in case it drops below a certain level

You would use the Scheduler to adjust the target temperature (i.e. lower at night, higher during the day). You’re not obligated to use Scheduler; you can use an automation, triggered at specific times, to adjust the target temperature.

How you turn on/off your heater? It is a switch or a thermostat in Home Assistant?

There is space for improvement, but this might do what you want:

description: ""
mode: single
trigger:
  - platform: state
    entity_id:
      - sensor.bedroom_hygrometer_temperature
condition: []
action:
  - choose:
      - conditions:
          - condition: numeric_state
            entity_id: sensor.bedroom_hygrometer_temperature
            above: 22
            alias: If temperature is above 22C at any time
        sequence:
          - service: climate.set_hvac_mode
            data:
              hvac_mode: "off"
            target:
              entity_id: climate.bedroom_thermostat
            alias: Turn off thermostat
      - conditions:
          - condition: and
            conditions:
              - condition: numeric_state
                entity_id: ""
                below: 18
                alias: Temperature is below 18C
              - condition: time
                after: "07:00:00"
                before: "22:00:00"
                alias: It's day time
            alias: Day time
        sequence:
          - service: climate.set_hvac_mode
            data:
              hvac_mode: heat
            target:
              entity_id: climate.bedroom_thermostat
            alias: Turn on thermostat
      - conditions:
          - condition: numeric_state
            entity_id: sensor.bedroom_hygrometer_temperature
            below: 10
            alias: Turn on thermostat if temperature is below 10 regardless the time
        sequence:
          - service: climate.set_hvac_mode
            data:
              hvac_mode: heat
            target:
              entity_id: climate.bedroom_thermostat
            alias: Turn on thermostat
1 Like

yes I manage to put a Shelly on it, its a switch in HA

yes clear, never used a scheduler with calling services you have a link with an example?

You only need the Scheduler if you want the ability to set/modify the thermostat’s schedule via the UI.

If it’s a simple schedule that you rarely need to modify then it can be done in an automation without employing the Scheduler integration.

1 Like

In this case it should look more like this:

description: ""
mode: single
trigger:
  - platform: state
    entity_id:
      - sensor.bedroom_hygrometer_temperature
condition: []
action:
  - choose:
      - conditions:
          - condition: numeric_state
            entity_id: sensor.bedroom_hygrometer_temperature
            above: 22
            alias: If temperature is above 22C at any time
        sequence:
          - service: switch.turn_off
            target:
              entity_id: switch.bedroom_thermostat
            alias: Turn off thermostat
      - conditions:
          - condition: and
            conditions:
              - condition: numeric_state
                entity_id: ""
                below: 18
                alias: Temperature is below 18C
              - condition: time
                after: "07:00:00"
                before: "22:00:00"
                alias: It's day time
            alias: Day time
        sequence:
          - service: switch.turn_on
            target:
              entity_id: switch.bedroom_thermostat
            alias: Turn on thermostat
      - conditions:
          - condition: numeric_state
            entity_id: sensor.bedroom_hygrometer_temperature
            below: 10
            alias: Turn on thermostat if temperature is below 10 regardless the time
        sequence:
          - service: switch.turn_on
            target:
              entity_id: switch.bedroom_thermostat
            alias: Turn on thermostat

I’ve hard coded the time for the “warm hours”, so if you have to change this, you will have to edit the automation which requires the right privileges and the right knowledge.
When @123 talk about using a Schedule is to transfer this time management to the UI, so you can edit it in a calendar, in a much more friendly and flexible way. You definitely should think about going on that direction.
Then your code will look more like this:

description: ""
mode: single
trigger:
  - platform: state
    entity_id:
      - sensor.bedroom_hygrometer_temperature
condition: []
action:
  - choose:
      - conditions:
          - condition: numeric_state
            entity_id: sensor.bedroom_hygrometer_temperature
            above: 22
            alias: If temperature is above 22C at any time
        sequence:
          - service: switch.turn_off
            target:
              entity_id: switch.bedroom_thermostat
            alias: Turn off thermostat
            data: {}
      - conditions:
          - condition: and
            conditions:
              - condition: numeric_state
                entity_id: ""
                below: 18
                alias: Temperature is below 18C
              - condition: state
                entity_id: schedule.thermostat_warm_hours
                state: "on"
            alias: Day time
        sequence:
          - service: switch.turn_on
            target:
              entity_id: switch.bedroom_thermostat
            alias: Turn on thermostat
            data: {}
      - conditions:
          - condition: numeric_state
            entity_id: sensor.bedroom_hygrometer_temperature
            below: 10
            alias: Turn on thermostat if temperature is below 10 regardless the time
        sequence:
          - service: switch.turn_on
            target:
              entity_id: switch.bedroom_thermostat
            alias: Turn on thermostat
            data: {}

Then you can create a schedule (Setting → Devices and Services → Helpers) with more flexible times (a different warm time for weekends, for example):

1 Like