Martin Jerry MJ-S01 (Single Pole)
Single Pole Decora US switch. This switch has a customizable Red and Blue LED, this setup uses a rule to toggle between the two LEDs. As of the Summer of 2022, Martin Jerry is now offering a TASMOTA Pre-flashed model!
Pre-Flashed with TASMOTA Amazon
Purchase via Amazon
Detailed video integration into Home Assistant
Tasmota Template
{"NAME":"MJ-S01 2Way Switch","GPIO":[1,1,1,1,288,321,0,0,224,32,544,1,0,0],"FLAG":0,"BASE":18, "CMND": "SO30 1 | SO13 1"}
GPIO Layout
GPIO | Component | Description |
---|---|---|
GPIO04 | Led1 | Red LED |
GPIO05 | Led2 | Blue LED |
GPIO12 | Relay1 | Actual relay to toggle on/off |
GPIO13 | Button1 | Button |
TASMOTA Settings
Setting | Description |
---|---|
setoption13 1 | Set On/Off switch to respond instantly (optional) |
setoption30 1 | Sets domain to a light (optional) |
TASMOTA Rules
If a Red LED while Off and Blue LED while On is desired paste the following rule into the Tasmota console. If you want opposite colors, edit the template in the configure template screen and transpose Led_i with Led and vice versa. The "i" stands for inverted. Copy the below rule as one line to the Tasmota console:
Rule1 on power1#state do backlog ledpower1 %value%; ledpower2 %value% endon
on power1#boot do backlog ledpower1 %value%; ledpower2 %value% endon
Activate the Rule with
Rule1 1
ESPHome YAML
substitutions:
device_name: light_switch1 #CustomizeThis
friendly_name: Light Switch1 #CustomizeThis
icon: "mdi:light-switch"
esphome:
name: ${device_name}
platform: ESP8266
board: esp01_1m
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
ap:
ssid: ${device_name} Portal
password: !secret esphome_ap_password
web_server:
captive_portal:
logger:
api:
ota:
platform: esphome
output:
- platform: gpio
pin: GPIO12
id: switch_output
- platform: gpio
pin:
number: GPIO4
inverted: true
id: red_led_output
light:
- platform: binary
name: ${friendly_name}
id: ${device_name}
output: switch_output
on_turn_on:
- light.turn_on: red_led
on_turn_off:
- light.turn_off: red_led
- platform: binary
id: red_led
output: red_led_output
binary_sensor:
- platform: gpio
pin:
number: GPIO13
id: ${device_name}_button
name: ${friendly_name} Button
on_press:
- light.toggle: ${device_name}
status_led:
# Blue LED
pin:
number: GPIO5
inverted: true