TEMPer and RF switch as a makeshift thermostat

looking to build an automation that will compare the temp from a TEMPer sensor and the value of an input slider, if they don’t match, turn on a switch. then once they do match, turn off the switch.

does anyone have some example or similar code i can look at?

Try the Generic Thermostat component. You specify the temperature sensor and the switch the heater is connected to. It has worked very well for me with a space heater in one of our cold bedrooms.

what kind of control does that climate instance give you?
it looks like it runs 24/7.

i only want this to run when it detects i am home.

this is my rough sketch…

alias: 'Auto Cooling'
  trigger:
    platform: homeassistant
    event: start
  condition: and
  conditions:
    - condition: state
      entity_id: device_tracker:iphone_iphone
      state: 'home'
    - condition: state
      entity_id: input_boolean.cooling_system
      state: 'on'
    - condition: numeric_state
      entity_id: sensor.temper_stat
      above: {{ states.input_slider.ac_thermostat }}
  action:
      service: switch.turn_on
      entity_id: switch.switch_1

I’ll paste my set up below. You’re right, there isn’t a way to just ‘turn off’ the generic thermostat (at least not that I found), so I set the default target very low (50 F), and then use an automation to set the target to a realistic temperature when certain conditions are met, for instance, when the house thermostat is in ‘sleep’ mode. This effectively turns off the thermostat when I don’t want it running. You could easily do the same with a different condition, such as the device tracker.

In the fronted, it displays the same as a regular thermostat would. When you click on it, it shows a graph with history, and allows you to set a target. It used to display as a slider, i think in one of the recent versions upgrades, it changed to up and down arrows.

Config:

climate:
  - platform: generic_thermostat
    name: Space Heater
    heater: switch.space_heater
    target_sensor: sensor.bedroom_temperature
    min_temp: 60
    max_temp: 80
    target_temp: 50
    tolerance: 1
    min_cycle_duration:
      minutes: 2

Automations:

- alias: 'Space Heater Sleep Mode on'
  trigger:
    - platform: state
      entity_id: sensor.homestead_mode
      to: 'Sleep'
  action:
    - service: climate.set_temperature
      data:
        entity_id: climate.space_heater
        temperature: 70

- alias: 'Space Heater Sleep Mode off'
  trigger:
    - platform: state
      entity_id: sensor.homestead_mode
      from: 'Sleep'
  action:
    - service: climate.set_temperature
      data:
        entity_id: climate.space_heater
        temperature: 50

Hope this helps!

this would prolly work better.
but yeah, i’ll play with the climate one.

- alias: 'Auto Cooling'
  trigger:
    platform: homeassistant
    event: start
  condition: and
  conditions:
    - condition: state
      entity_id: device_tracker:iphone_iphone
      state: 'home'
    - condition: state
      entity_id: input_boolean.cooling_system
      state: 'on'
    - condition: template
      value_template: '{{ states.sensor.temper_stat > states.input_slider.ac_thermostat }}'
  action:
    service: switch.turn_on
    entity_id: switch.switch_1

what is your sensor.homestead_mode ?
just curious.

That’s a template sensor based on an attribute from my ecobee (the ecobee is named homestead)

      homestead_mode:
        friendly_name: 'Homestead Mode'
        value_template: "{{ states.climate.homestead.attributes.mode }}"