DIY MQTT Thermostat integrated into Home Assistant

Hey all. I built this about 2 years ago, but I thought I would share it with the community. I have a touchscreen thermostat (Raspberry Pi + DS18B20 sensor) that I use to control my heat pump AND my whole house wood burner. I wrote it over several months in Python and have integrated it into HA. It works quite well using MQTT and I also use HA to trigger thermostat actions based on the outside weather (I have an Arduino based MQTT weather station). I plan to make it even better by putting in sensors all over the house and have HA adjust dampers to each room based on occupancy and also to try and even out the house temperature. My Python skills are rudimentary at best, but it does work…

HA-thermo

If anyone has any questions or has done a similar project, would love to hear about it.

5 Likes

Thanks for share, is it homemade display as shown in your post ?

Its a Raspberry Pi 7" Touch Display and I used Kivy to design the graphics layout.

Thanks for details :wink:

Hi ericleejoe I´ve also a thermostate created with two sonoff and a temperature sensor and it works fine but I´d like to know how have you created this view in Home Assistant, the slide, the heat function, etc. In my case I have to click in the thermostate in order to open it and see these controls, but you have them all in the main view. Could you share the configuration to do this?
Thanks

The view is created using the groups.yaml file. My thermostat publishes most of its functions to MQTT where home assistant sees them as sensors

- platform: mqtt
  state_topic: "topic/insidetemp"
  name: "Inside Temp"
  qos: 0
  unit_of_measurement: "°F"

- platform: mqtt
  state_topic: "topic/function"
  name: "Function"
  qos: 0
  unit_of_measurement: ""

- platform: mqtt
  state_topic: "topic/desiredtemp"
  name: "Desired Temperature"
  qos: 0
  unit_of_measurement: "°F"

The input select is show here (from my configuration.yaml)

input_select:
   thermostat_mode:
    name: Thermostat Mode Control
    options:
     - "Heat"
     - "Cool"
     - "Off"

  thermostat_hold:
    name: Thermostat Hold
    options:
     - "Run"
     - "Hold"
   

The slider config is (from input_number.yaml)

slider1:
    name: Temperature
    initial: 72
    min: 65
    max: 80
    step: 1

from my groups.yaml

Heat Pump:
 icon: mdi:gauge
 entities:
 - sensor.function
 - sensor.inside_temp
 - sensor.desired_temperature
 - input_number.slider1
 - switch.schedule
 - input_select.thermostat_mode
 - input_select.thermostat_hold

Wow, I see now.
I’ll try to do this with my setup.
Thanks for your quick reply

1 Like

Do you have the code on Github or Gitlab or other repository by chance?

I don’t and the code is really ugly as I am not a coder :blush:

Looks cool !
I’m kind of starting Something like you, but even more a newbee :blush:
Heatpump, pelletburner and want to add a lot of temp sensors in and around the house. But still have to learn python.
Starting to try to connect everything and readout.

This is really neat, I’ve used this as the basis for setting up my zonal heating.

Can you provide a link to all of the code for this? Or post it somehow? I’m not any better at the code than you but I know enough to figure it out and get it working. I just want to see what you have figured out to save time on mine. Thanks in advance