ESPHome compatible 3-way light switches?

@bakaufman Do you have the link for the MJ 3 wire cut you did? I’d like to test that out as I am struggling with my MJ ST01 3 ways not being able to detect load correctly. They click on-off-on or off-on-off when I toggle the switch. My other one just toggles constantly when power is applied.

I tried using this and I get the following when I try to validate:

  on_press: 
    - then: 
        - switch.toggle: 
            
            ID 'white_led' of type light::LightState doesn't inherit from switch_::Switch. Please double check your ID is pointing to the correct value.
            id: white_led
  on_release: 
    - then: 
        - switch.toggle: 
            
            ID 'white_led' of type light::LightState doesn't inherit from switch_::Switch. Please double check your ID is pointing to the correct value.
            id: white_led

Thank you for the find. I guess I had uploaded an older version of the code. I changed the white_led to a function of light rather than switch. I will update the above code. If you want to update yours and validate it should be

binary_sensor:
  - platform: gpio
    id: power_sensor
    pin:
      number: GPIO14
      inverted: True
    filters:
      - delayed_off: 50ms
    on_press:
      - light.turn_off: white_led
    on_release:
      - light.turn_on: white_led
    internal: True

Thanks All especially @philb & @PacketLoss

I beat my head against this problem for a while and your advise in this thread finally got me over the hump and helped me learn a few things. Now I have all 7 of these three-way switches in my house configured!

Here is a logic I put together based on my observations. I still cannot see the actual state of the template switch it shows it off for all conditions. The correct events are happening however.

Scott how did you get your light switch button on home assistant to show the correct state? on or off. the light bulb on HA is always off.

Note that the power sensor on these switches seem to have problems detecting load on some CFL bulbs.

I do have led lights on those switches. But the switch works as needed it just doesn’t report the state correctly so the sensor is detecting something. Is there a way i can debug to check the state of the sensor? Maybe the logic to report state is wrong.

Did you found the link for the 3 wire cut? Im having problems with the load sensor turning on/off repeatedly.

Sorry for the dummy question, but where do you convert from basic to a light swithc?

1 Like

Either add it to your configuration.yaml or, build your own .yaml files under the packages folder add identify the file as to what area it covers i.e. basement_lights.yaml or bedrooms.yaml.

I use the second method, that way if I mess something up and it stops working instead of going through hundreds of lines of code in the configuration.yaml . I just go to the file that handles whatever stopped working and find an fix it easier.

Here is a copy of my:

basement_lights.yaml

light:
  - platform: switch
    name: Basement light zone 2
    entity_id: switch.basement_light_zone_2

  - platform: group
    name: All Basement Lights
    entities:
      - light.basement_light_stairs
      - light.basement_light_zone_1
      - light.basement_light_zone_2
      - light.basement_light_office
  - platform: group
    name: Basement Lights
    entities:
      - light.basement_light_stairs
      - light.basement_light_zone_1
      - light.basement_light_zone_2

automation:
- alias: basement_long_click_on
  trigger:
  - event_data:
      title: long_press_on
    event_type: esphome.basement_light_stairs
    platform: event
  - event_data:
      title: long_click
    event_type: esphome.basement_light_zone_1
    platform: event
  action:
  - service: light.turn_on
    entity_id: light.basement_lights
  mode: single
- alias: basement_click_off
  trigger:
  - event_data:
      title: long_press_off
    event_type: esphome.basement_light_stairs
    platform: event
  - event_data:
      title: double_click
    event_type: esphome.basement_light_zone_1
    platform: event
  action:
  - service: light.turn_off
    entity_id: light.all_basement_lights
  mode: single

In here there are two different entities types.

The first is:
- platform: switch

This tells HA that I want to convert a switch into a light.
Now I’ll have two different basement_light_zone_2 entities:

  1. switch.basement_light_zone_2
  2. light.basement_light_zone_2

And the second one:
- platform: group

This tells HA that I want to combine an array of entities into a group. (which help with automations and also voice assistant integration)
So now I have two light groups

  1. light.all_basement_lights
  2. light.basement_lights

In my case I have some physical switches that are programed as light entities and some that are switch entities so, by having HA convert the switches to lights it makes it easier to create a group without having to remember which where switches and which where lights. Plus, it’s been a
long while but, I’m pretty sure light group doesn’t like switches and lights mixed, I could be wrong.

I hope this helps. If not @finity posted the link for the HA light tutorial.

1 Like

Thank you!!
I did a similar thing to you, and also learned about groups :slight_smile:

1 Like

I’m not intending to resurrect this thread unnecessarily, but I wanted to share my more recent experience with these Tasmota-flashed Martin Jerry 3-way switches. I realize I’m posting this in an ESPHome forum, but I figured it couldn’t hurt to warn folks that the devices are using Tuya internally. I confirmed this in a Martin Jerry support chat, and I’m stuck using the limited set of TuyaMCU commands within Tasmota.

I have no idea if the non-Tasmota versions still use a non-Tuya solution… or whether they’ve migrated over to a Tuya-only solution for their 3-way switches. I’ve inquired with Martin Jerry and haven’t heard a response yet.

@philb . Any chance you have a way to convert this to the Bekin (Cloudcutter) model? Sorry if that’s a crazy question. I’m new! :). Im cloud cut and ESPHome’d just need a config and lost about the 3 way dimmer

Please point is to the exact device, not some generic description. Model number, Amazon link, Ali link etc.