Automate smart plug with temp sensor

Hi, iam new to HA.
Trying to get a smart plug to turn on and of based on min-max temperature set on the temp sensor…
Does somebody know how to do this simple automation?

Use the Generic Thermostat integration.

hi, thank u for the reply. I have tried but cant get it to work… dont know what iam doing wrong.

Post what you tried.

  - platform: generic_thermostat
    name: Study
    cooler: switch.lumi_lumi_plug_maeu01_on_off
    target_sensor: sensor.lumi_lumi_weather_temperature
    min_temp: 3
    max_temp: 4
    ac_mode: false
    target_temp: 4
    cold_tolerance: 0.3
    hot_tolerance: 0
      seconds: 5
      minutes: 3
    initial_hvac_mode: "off"
    away_temp: 4
    precision: 0.1

I put this in the file editor in a yaml config

Do you really only want to control over the temperature range 3 to 4°?

yes i want it to be between 3 and 4 degrees C

it is just to controll the temprature inside a freezer. making a refrigirator of a large freezer. Making the freezer turn off when temp goes below 3 degrees, and on if it goes over 4.

What is not working? Is the temperature going above 4°?
Do you know how long it takes from your cooler starts until the temperature starts changing? Have you measured that manually?

The plug does not turn on when temp is 6 degrees. I can see the sensor temp at 6, so if it was working i would see the plug turn on. But its not.

1 Like

Post a screenshot of the thermostat climate entity from developer tools.

it is not a thermostat, it is just a temp sensor.

Did you turn the thermostat on and set the temperature?

    heater: switch.lumi_lumi_plug_maeu01_on_off
    ac_mode: true

According to the documentation, there’s no option called “cooler”. Use heater and set ac_mode to true.


The sensor inside the freezer is on and connected, and also the smart plug which i want it to turn on and off. When the temp is above the threshold of 4 degrees I want the smartplug to power the freezer and start to lower the temp. once it is below 3, I want the smartplug to turn off.

Thanks 123, i tried, but still no effect

Not what I meant.

Once you have created your generic thermostat you will be presented with an entity like these two (if you put it in a climate card):

Screenshot 2022-05-08 at 23-09-39 Overview – Home Assistant

My Upstairs thermostat is on. My downstairs thermostat is not.

Did you turn your thermostat on?

Describe your testing procedure.

ah sorry. I cant seem to find the thermostat. wont show up as an entity…

Is it in Developer Tools / States (

If so, add a climate card to your dashboard. Or just click on this button next to it in the Dev Tools list Screenshot 2022-05-08 at 23-16-07 Developer Tools – Home Assistant then set the Operation Mode.

It implies what you added to configuration.yaml was never loaded. Did you restart Home Assistant?