Sonoff temp sensor

Hi guys new to home assistant and loving what i see so far i have added my sonoff temp sensor to HA and is working to display temps and humidity i am now wondering if there is a easy way to have the sensor turn on and off my green house heater when temp drops below a set temp. sorry if this has been answered before or is a noob question thanks in advance for any info.

Yes. Have you considered using the Generic Thermostat integration?

Thanks Taras i will check it out and post back :slight_smile:

Let me know if you need help configuring it.

hay Taras,
dose this look right to you also do i just add this to my configuration.yaml and it should work or is there more i need todo inside the web ui thanks again.

#greenheater

climate:

  • platform: generic_thermostat
    name: green house
    heater: switch.sonoff_1000cf8fc2
    target_sensor: sensor.sonoff_1000cf8fc2_temperature
    min_temp: 18
    max_temp: 22
    ac_mode: false
    target_temp: 20
    cold_tolerance: 0.3
    hot_tolerance: 0
    min_cycle_duration:
    seconds: 5
    keep_alive:
    minutes: 3

Looks good to me. The way you have it configured will maintain the temperature at 20 degrees, plus or minus 0.3 degrees. The only reason to use the web UI is for the convenience of changing the setpoint (target) temperature.

1 Like

Thanks Tara’s :+1:

1 Like

You’re welcome!

Please consider marking my post (above) with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has an accepted solution. This helps other users to find answers to similar questions.

Hay Taras for some reason generic_thermostat is not turning my switch on and off i have tryed to use - platform: programmable_thermostat to see if i have any more luck config i am using is.

#green heat

climate:

  • platform: programmable_thermostat
    name: greenhouse
    heater:
  • switch.sonoff_1000cf8fc2
    actual_temp_sensor: sensor.sonoff_1000cf8fc2_temperature
    min_temp: 18
    max_temp: 20
    target_temp_sensor: sensor.sonoff_1000cf8fc2_temperature
    tolerance: 0.3

the error i get is

  • Invalid config for [climate.generic_thermostat]: extra keys not allowed @ data[‘actual_temp_sensor’]. Got ‘sensor.sonoff_1000cf8fc2_temperature’ extra keys not allowed @ data[‘target_temp_sensor’]. Got ‘sensor.sonoff_1000cf8fc2_temperature’ extra keys not allowed @ data[‘tolerance’]. Got 0.3 required key not provided @ data[‘target_sensor’]. Got None value should be a string for dictionary value @ data[‘heater’]. Got [‘switch.sonoff_1000cf8fc2’]. (See ?, line ?).
  • Error loading /config/configuration.yaml: while parsing a block mapping in “/config/configuration.yaml”, line 61, column 5 expected , but found ‘’ in “/config/configuration.yaml”, line 63, column 22
  • Error loading /config/configuration.yaml: while parsing a block mapping in “/config/configuration.yaml”, line 60, column 5 expected , but found ‘’ in “/config/configuration.yaml”, line 62, column 22
  • Error loading /config/configuration.yaml: mapping values are not allowed here in “/config/configuration.yaml”, line 54, column 23
  • Error loading /config/configuration.yaml: mapping values are not allowed here in “/config/configuration.yaml”, line 38, column 23

thanks again.

You appear to have gone in a different direction than what I suggested. What is this integration called ‘programmable_thermostat’?

platform: programmable_thermostat

for some reason generic_thermostat is not turning my switch on and off

Let’s focus on correcting this issue with the Generic Thermostat integration. The first thing is that it’s important to post a formatted configuration:

climate:
  - platform: generic_thermostat
    name: green house
    heater: switch.sonoff_1000cf8fc2
    target_sensor: sensor.sonoff_1000cf8fc2_temperature
    min_temp: 18
    max_temp: 22
    target_temp: 20
    min_cycle_duration:
      seconds: 5

Hay Taras,
yes

here is git link

Like I said, you went off in a different direction and chose a custom component (that I am unfamiliar with). I can help you with the Generic Thermostat integration but someone else will have to help you with Programmable Thermostat.

Thanks Taras i think i have fixed it not 100% sure how but i added integration then added Entity Card and all seems to be running thanks again for all your help :smiley: