Reversing the relay state

Hello everyone,
I am using a relay module which i gave the link at the bottom. This module uses GPIO0 pin’s LOW state for drive the relay. I uploaded this YAML codes to the ESP8266-01;


esphome:
  name: thermostatkombi

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "0qH1FtrL3ljWiYMzFFnbYhVKhCAE+ZsNjcUaAI1S7Mg="

ota:
  password: "de11ca42a2509b9737dcd0e877409b06"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Thermostatkombi Fallback Hotspot"
    password: "Xr3UlY3bqAmv"

captive_portal:

switch:
  - platform: gpio
    name: "Kombi Relay"
    pin: 0

I am using the COM and NO terminals for switching on the my boiler. But when i send the turn on boiler command with “switch.turn_on” in the automatin codes ESPHome sends the HIGH to the GPIO0 and relay remains turn off. But when i send the turn off boiler command with “switch.turn_off” then ESPHome sends LOW to the GPIO0 and relay turns on. This is no problem in coding for me. I changed all the “on” commands to “off” and “off” commands to “on” but when i go to the dashboard It appears to be “on” when the boiler is “off”.

Is there any way to change dashboard’s card for boiler status from on to off and vice versa? Also may be there is a way for ESPHome to change the state of the GPIO0 pin.

Thanks in advance…

switch:
  - platform: gpio
    name: "Kombi Relay"
    pin: 0
    inverted: true # <------ This will change it to active low

The other option is to wire the boiler using COM and NC.

You will have to undo all the switch services you swapped.

2 Likes

Thank you…

1 Like