I’m looking for some help and guidance in getting ESPHome working nicely on the Hidin MFA03 light switch which is ESP8266 based if you manage to get some older versions.
I have it working okay with Tasmota turning on and off but hoping someone could work with me to get ESPhome onto it instead and also control the status LEDs. I’ve got a few esphome based sensors but never done a light switch with it’s status LED etc…
I don’t know if I have all the GPIOs correct but this is what I currently have in my Tasmota template…
GPIO0 - Button 1
GPIO5 - Switch 1
GPIO12 - Relay 1
GPIO13 - LedLink_i
GPIO14 - Switch 2
Any help would be greatly appreciated and hopefully this could be useful to others…
This is what I have so far and it seems to be working okay.
I’m not sure if I have the LEDs configure the recommended way but at least I have them working as GREEN if light is on and BLUE when light is off.
I have some of these switches running on Tasmota and the BLUE led is very bright but with ESPHome not so much, I wonder what could be causing that?
###############################################################################
# Binary Sensors
###############################################################################
binary_sensor:
# Main Switch
- platform: gpio
name: "$device_name Button"
id: main_switch
pin:
number: GPIO0
mode: INPUT_PULLUP
internal: true
on_press:
- switch.toggle: relay # Toggles the relay when the physical button is pressed
###############################################################################
# Switches
###############################################################################
switch:
# Internal Relay
- platform: gpio
name: "$device_name Light"
id: relay
pin: GPIO12
icon: "mdi:lightbulb"
device_class: "switch"
restore_mode: RESTORE_DEFAULT_OFF # Tries to restore state but turns off if no state found
on_turn_on:
- switch.turn_on: green_led
- switch.turn_off: blue_led
on_turn_off:
- switch.turn_off: green_led
- switch.turn_on: blue_led
# Status LED (Blue)
- platform: gpio
id: blue_led
device_class: "switch"
pin:
number: GPIO13
mode: OUTPUT_OPEN_DRAIN
inverted: true
internal: true
# Status LED (Green)
- platform: gpio
id: green_led
device_class: "switch"
pin:
number: GPIO4
mode: OUTPUT
internal: true