Hi there!
It has been one month since @vladosam and me did this, and I figured we should share the project, as I think someown out there will find this thing usefull.
What we did (@vladosam did most of the stuff, i was more like ginny pig) is to convert my old central heater in the apartmen in to smart heater
I hooked up sonoff basic in to boiler (central heater) instead of the old thermostat. I already had some temperature sensors around apartment (xiaomi and BRUH multisensor).
This is how it looks like in the HA frontend:
And here is my configuration package:
######################
# Climate - central heater
######################
climate:
- platform: generic_thermostat
name: Heater
heater: switch.heater
target_sensor: sensor.sn1_temperature
min_temp: 20
max_temp: 29
target_temp: 21
tolerance: 0.3
######################
# Automation part
######################
automation:
- alias: 'Time heater on'
hide_entity: true
trigger:
- platform: template
value_template: '{{ states.sensor.time.state == states.sensor.alarm_time_heater.state }}'
condition:
condition: or
conditions:
- condition: and
conditions:
- condition: state
entity_id: input_boolean.alarmweekday_heater
state: 'on'
- condition: state
entity_id: binary_sensor.working_day
state: 'on'
- condition: state
entity_id: input_boolean.alarmweekday_heater
state: 'off'
action:
- service: climate.set_operation_mode
data:
entity_id: climate.heater
operation_mode: "auto"
- service: climate.set_temperature
data_template:
entity_id: climate.heater
temperature: '{{ states.input_number.set_temp_heater.state }}'
- alias: 'Turn heater ON boolean switch'
hide_entity: true
trigger:
- platform: state
entity_id: climate.heater
to: 'heat'
action:
- service: homeassistant.turn_on
entity_id: input_boolean.automode_heater
- alias: 'Turn time heater OFF'
hide_entity: true
trigger:
- platform: state
entity_id: input_boolean.timeonoff_heater
to: 'off'
action:
- service: automation.turn_off
entity_id: automation.time_sheduler_heater
- alias: 'Timer scheduler ON'
hide_entity: true
trigger:
- platform: state
entity_id: input_boolean.timeonoff_heater
to: 'on'
action:
- service: automation.turn_on
entity_id: automation.time_sheduler_heater
- alias: 'thermostat_heater Temp'
hide_entity: true
trigger:
- platform: state
entity_id: input_number.set_temp_heater
action:
- service: climate.set_temperature
data_template:
entity_id: climate.heater
temperature: '{{ states.input_number.set_temp_heater.state }}'
- alias: "thermostat_heater On"
hide_entity: true
trigger:
platform: state
entity_id: input_boolean.automode_heater
from: 'off'
to: 'on'
action:
- service: climate.set_operation_mode
data:
entity_id: climate.heater
operation_mode: "auto"
- service: climate.set_temperature
data_template:
entity_id: climate.heater
temperature: '{{ states.input_number.set_temp_heater.state }}'
- alias: "thermostat_heater Off"
hide_entity: true
trigger:
platform: state
entity_id: input_boolean.automode_heater
from: 'on'
to: 'off'
action:
- service: climate.set_operation_mode
data:
entity_id: climate.heater
operation_mode: "off"
# thermostat INITIALIZATION
- alias: 'HASS startup'
initial_state: true
hide_entity: true
trigger:
- platform: homeassistant
event: start
action:
- service: climate.set_operation_mode
data:
entity_id: climate.heater
operation_mode: "off"
- service: climate.set_operation_mode
data:
entity_id: climate.heater
operation_mode: "off"
- service: homeassistant.turn_on
entity_id: input_boolean.timeonoff_heater
- delay: '00:00:02'
- service: homeassistant.turn_off
entity_id: input_boolean.timeonoff_heater
- service: homeassistant.turn_on
entity_id: input_boolean.timeonoff_heater
- delay: '00:00:02'
- service: homeassistant.turn_off
entity_id: input_boolean.timeonoff_heater
sensor:
- platform: template
sensors:
alarm_time_heater:
friendly_name: 'Time'
value_template: '{{ "%0.02d:%0.02d" | format(states("input_number.alarmhour_heater") | int, states("input_number.alarmminutes_heater") | int) }}'
input_boolean:
alarmweekday_heater:
name: Worday only
icon: mdi:calendar
automode_heater:
name: 'Set AUTO / OFF'
initial: off
timeonoff_heater:
name: 'Scheduled heater'
initial: off
input_number:
alarmhour_heater:
name: Hour
icon: mdi:timer
min: 0
max: 23
step: 1
alarmminutes_heater:
name: Minutes
icon: mdi:timer
min: 0
max: 59
step: 1
set_temp_heater:
mode: slider
name: Set temperature
initial: 21
min: 15
max: 30
step: 0.5
unit_of_measurement: "°C"
This is in groups.yaml
Central heater:
name: Central heater
control: hidden
entities:
- climate.heater
- switch.heater
- input_boolean.automode_heater
- input_boolean.timeonoff_heater
- sensor.alarm_time_heater
- input_number.set_temp_heater
- input_number.alarmhour_heater
- input_number.alarmminutes_heater
- input_boolean.alarmweekday_heater
As I had almost all of this in Croatian language (automations and switch names etc.), I did my best to translate it to english, so everyone can understand what is what.