What can I really do with temperature sensors?

Hi guys, I’m new to this “world” and I’d like to automate my house more and more. The first thing I’d like to do is to automate my heating system. What I’d like to do is put a wifi thermometer (like Xiaomi Mijia or Shelly H&T) and an electric switch (Shelly 1 or Sonoff). I want my automation to read the temperature only at different time of day depending by the day, then if the temperature is low turn on the switch to heat the room, if the temperature is too high turn off the heating.


this is a sketch of what I’d like to do. Is it possible in HA? What hardware do i need to make it work best? Do i need to use automations, scenes or something like that? Sorry if this may seems elementar but I can’t really understand of HA works and how to make something if some other thing happens, and there’s no detailed guide I could find. Thanks.

Yes, this is easily accomplished using generic thermostat:

1 Like

Hi, I think you are spot on with your proposed hardware for a basic setup.

You can control the switch based on the temperature using the Generic Thermostat Integration as documented here:

This is an example from my config:

- platform: generic_thermostat
  name: Ensuite
  heater: switch.ensuite_radiator
  target_sensor: sensor.ensuite_temperature
  min_temp: 15
  max_temp: 30
  ac_mode: false
  target_temp: 22
  cold_tolerance: 0.1
  hot_tolerance: 0.5
  min_cycle_duration:
    seconds: 10
  initial_hvac_mode: "off"
  away_temp: 7
  precision: 0.1

All you then need is a simple automation to turn the thermostat on and another to turn it off at the relevant times e.g.

- id: '1601881943169'
  alias: Ensuite Thermostat Control On
  description: ''
  trigger:
  - platform: time
    at: '07:00:00'
  condition: []
  action:
      - service: climate.turn_on
        data: {}
        entity_id: climate.ensuite
  mode: single

This is very basic but it would be an easy way to get started. You could then develop this by adding new functionality like using variables for the on/off times or adding a boost mode to turn the device on for a fixed period outside of the normal time range.

Hope that helps!

1 Like