Help with climate control

I am trying to control a heater with a fairly complex setup. The power switch for this setup must pulse twice for about 1 second to turn on, and pulse once for about 5 seconds to turn off.

I have achieved this is esphome with the following code.

The problem I am now facing is controlling this via the “generic thermostat” integration and using the better-thermostat ui card.

The problem im having is

  • The entitty does not turn off, when dragging the tempreature above the target target temp, it is switch the entity on, pulsing twice.

  • However, when dragging the tempreature below the target tempreature, it does not turn the entity on, Pulse once for 5 seconds.

  • Also, when the tempreate is just left and it does not seem to be any significant changes, the entity just keeps switching on, pulsing twice per second even when there is no change. Is this normal behavior for the generic thermostat or even the better-thermostat UI? It seems to be turning ON every 5 minutes even when already ON.

  - platform: generic_thermostat
    name: Camper
    heater: switch.heater_control_heater_power
    target_sensor: sensor.heater_control_camper_temperature
    ac_mode: false
  - platform: dallas
    address: 0xa85e61b81e64ff28
    name: "Camper Temperature"

  - platform: template
    id: pulse_relay_1
    name: Heater Power
      - switch.turn_on: heaterpower
      - delay: 1s
      - switch.turn_off: heaterpower
      - delay: 1s 
      - switch.turn_on: heaterpower
      - delay: 1s
      - switch.turn_off: heaterpower
      - delay: 1s 
      - switch.turn_on: heaterpower
      - delay: 5s
      - switch.turn_off: heaterpower
      - delay: 1s 
  - platform: gpio 
    pin: GPIO5
    id: heaterpower
    internal: true
type: custom:better-thermostat-ui-card
entity: climate.camper
disable_window: true
disable_off: false
disable_buttons: false
disable_heat: false
set_current_as_main: false
eco_temperature: 22
disable_battery_warning: true
disable_menu: false
disable_summer: true
disable_eco: true

Any ideas?

Try to add optimistic: True to pulse_relay_1.

  • optimistic (Optional, boolean): Whether to operate in optimistic mode - when in this mode, any command sent to the template switch will immediately update the reported state. Defaults to false.

Without optimistic You must publish state true/false for switch in code.