devices.esphome.io

Martin Jerry Wall Switch MJ-S01

Martin Jerry Wall Switch MJ-S01

Device Type: switch
Electrical Standard: us
Board: esp8266

Amazon Link

General Notes

This switch uses tuya so you can use tuya-convert to flash ESPHome.

GPIO Pinout

PinFunction
GPIO4led1 (inverted)
GPIO5led2 (inverted)
GPIO13main button (input_pullup)
GPIO12relay (inverted)

Basic Configuration

# Basic Config
---
substitutions:
# # https://esphome.io/guides/configuration-types.html#substitutions
device_name: martin_jerry_mj_s01 # hostname & entity_id
friendly_name: Martin Jerry MJ-S01 # Displayed in HA frontend
ip_address: !secret martin_jerry_mj_s01_ip # use /config/esphome/secrets.yaml
esphome:
# https://esphome.io/components/esphome
name: ${device_name}
esp8266:
board: esp01_1m
restore_from_flash: true
# OTA flashing
ota:
- platform: esphome
wifi: # Your Wifi network details
# Enable fallback hotspot in case wifi connection fails
ap:
# Enabling the logging component
logger:
# Enable Home Assistant API
api:
# Enable the captive portal
captive_portal:
# Enable the Web Server component
webserver:
switch:
# relay output
- platform: gpio
id: relay
name: $friendly_name
pin: GPIO12
on_turn_on: #blue when on
- switch.turn_on: blue_led
- switch.turn_off: red_led
on_turn_off: #purple when off
- switch.turn_on: blue_led
- switch.turn_on: red_led
- platform: gpio
# https://esphome.io/components/switch/gpio.html
pin: GPIO04
id: red_led
name: $friendly_name Red LED
inverted: true
- platform: gpio
# https://esphome.io/components/switch/gpio.html
pin: GPIO05
id: blue_led
name: $friendly_name Blue LED
inverted: true
binary_sensor:
- platform: gpio
# https://esphome.io/components/binary_sensor/gpio.html
pin:
number: GPIO13
mode: INPUT_PULLUP
name: ${friendly_name} Main Button
internal: True
on_press:
- switch.toggle: relay
button:
- platform: restart
id: restart_button
name: $friendly_name Restart
entity_category: diagnostic
Edit this page on GitHub