Temperature sensor control relay

Hello

Im new to Home Assistant and being doing a lot of research to try finding a solution.

I am looking to control a damper with a relay toggle on/off (Sonoff). with a temperature sensor (Sonoff) to open and close when the temperature is reached but with a 2-3 degree differential for controling relay.
Ex: target temps is 22 relay OFF at 19 relay toggles to ON and gos OFF when rechead 22 and when the temps get to 25 relay toggles to ON and gos OFF at 22 to target temps.

I Have been loking to the generic Thermostat or dual thermostant but it dosent seem to work for me.
did a lot of texting

This is something that im tring to do but not convince

like

climate:
  - platform: generic_thermostat
    name: Chambre Edrick Volet
    heater: switch.sonoff_100109b432_3
    target_sensor: sensor.sonoff_a440004d71_temperature
    min_temp: 21
    max_temp: 23
    ac_mode: false
    target_temp: 22
    cold_tolerance: 0.5
    hot_tolerance: 0.5
    initial_hvac_mode: "off"
    precision: 0.1

automation:
    - alias: generic_thermostat Chambre Edrick Volet High
      trigger:
         - platform: numeric_state
           entity_id: sensor.sonoff_a440004d71_temperature
           above: 24 

      action:
         service: homeassistant.turn_on
         entity_id: switch.sonoff_100109b432_3_toggle

    - alias: generic_thermostat Chambre Edrick Volet Target
      trigger:
         - platform: numeric_state
           entity_id: sensor.sonoff_a440004d71_temperature
           target: 22
   
      action:
        service: homeassistant.turn_off
        entity_id: switch.sonoff_100109b432_3_toggle
        
    - alias: generic_thermostat Chambre Edrick Volet Low
      trigger:
         - platform: numeric_state
           entity_id: sensor.sonoff_a440004d71_temperature
           below: 20
   
      action:
        service: homeassistant.turn_on
        entity_id: switch.sonoff_100109b432_3_toggle

this

I’m honestly not sure what this does.

But I can’t remember having that in my config.

Why do you have automations?
Just delete that, the generic thermostat is supposed to do that itself.
Just mak sure the climate entity is on

@Hellis81
What do you mean by the climate entity is on ?

exemple of what i whant to

----on to open damper when below 20 to get temp back to 22 (Target)------><-----off to close the damper whent target reached 22-----><-----on When over 24 to get the temps back to 22 (target)

dont now if this cant help

sorry bad english writing

climate.chambre_edrick_volet

I understand your logic and that is exactly what the thermostat will do.

@Hellis81
And where do it put the entity ?

climate.chambre_edrick_volet

hen a look at the entity it says that :
This entity does not have a unique ID?

??

Look at developer tools, here is one of my generic thermostats:

When I click on the (i) I get this:
image

Is the entity in operation Heat or off?

The entity is on Heat

and the temp is a 25 but the damper is still off and should be at on too open the damper.

So it’s not a heating entity? In that case you need to set AC_mode: true in the generic thermostat (look at the documents because I’m not completely sure about the correct syntax)

it have to do heat and cool whit the same switch to open and close damper (2wire)

A switch can’t both heat and cool. What does your sonoff entity do?

@Hellis81

this is the sonoff relay

this is the sensor im using

The damper im using is 2Wire and spring retern

That is why i need it to open when its to cold to heat and when it gets to the target temp it go off and if it gets to hot it open to cold down.

this why the generic thermostat is not working well for me :confused:

In that case you need two generic thermostats or one of the custom component versions that has dual action.
But whichever route you go, you will not need automations if you configure it correctly

@Hellis81

I did a teste whit another code
this when it is cold the relay gos on to heat

This is when it get in the target temps.

and tha this is when it get hot the relay gos on to cool

This is the code

climate:
  - platform: dualmode_generic
    name: Teste
    unique_id: climate.test
    heater: switch.sonoff_100109b432_2
    cooler: switch.sonoff_100109b432_2
    #fan: switch.fan
    #fan_behavior: cooler
    #dryer: switch.dryer
    #dryer_behavior: cooler
    target_sensor: sensor.sonoff_a440004d71_temperature
    reverse_cycle: cooler, heater
    enable_heat_cool: True
    min_temp: 20
    target_temp: 22 #i added this
    max_temp: 23
    cold_tolerance: 0.8
    hot_tolerance: 0.4

You realise that we don’t understand what the different relays do?

the relay give power to the damper to open but when the relay thurn off the spring retern damper close position

Dont now if it whel said or written

If that is the case then it’s just a AC_mode generic thermostat.

When the temperature is “hot”, the generic thermostat turns on → turns on the switch to open the damper → room cools down.
Correct?
Then the room is at correct temperature and the thermostat goes off → switch off → spring closes damper → room heats up again.
?

@Hellis81

I would say more like this

When the temperature is “hot”, the generic thermostat turns on → turns on the switch to open the damper → room cools down.
Correct? Yes
Then the room is at correct temperature and the thermostat goes off → switch off → spring closes damper → room heats up again.
? Yes
And
When the temperature is “cold”, the generic thermostat turns on → turns on the switch to open the damper → room heats up again.

This damper is related to a ductable unit whit 5 oulet


that the thermostat is located in the leving room set at 23.
but in Edrick room the duct that feeds the room is close to the unite so the room go up fast in heat or when in cooling mode go cold fast to. This is why a need to control the damper.

Dot now if the extra info cant help ?

I understand now.
Not sure how that will work when you have the same switch as both heater and cooler.
Perhaps it works.

In my opinion the config seems correct

@Hellis81

It only control the air flow in the room. the wall heater is stil working for winter time.

if this cant explain more for info