Martin Jerry / Tessan Dimmer Automation Help [SOLVED]

Thanks so much. It makes much more sense to me now.
BTW I am good with the Pi’s have 6 in my home and car and all work well.

Hello. This is just a cosmetic thing:

if (dimmer_vals.is_on()) {
    id(dimmer_lvl) = dimmer_vals.get_brightness();
    if (id(dimmer_lvl) > .19) { id(led2).turn_on(); }
    if (id(dimmer_lvl) < .20) { id(led2).turn_off(); }
    if (id(dimmer_lvl) > .39) { id(led3).turn_on(); }
    if (id(dimmer_lvl) < .40) { id(led3).turn_off(); }
    if (id(dimmer_lvl) > .59) { id(led4).turn_on(); }
    if (id(dimmer_lvl) < .60) { id(led4).turn_off(); }
    if (id(dimmer_lvl) > .79) { id(led5).turn_on(); }
    if (id(dimmer_lvl) < .80) { id(led5).turn_off(); }
}
if (!dimmer_vals.is_on()) {
    id(led2).turn_off();
    id(led3).turn_off();
    id(led4).turn_off();
    id(led5).turn_off();
 }

Shouldn’t you use an if / else?

@Gonzakpo, no, not the way I intended for the dimmer level to be shown on the switch.

There are four LEDs that correspond to the brightness level, which means the LEDs will be illuminated up to the dimmer level. For example, a 60% dimmer level will illuminate LED2 (bottom), LED3 (2nd up from bottom), and LED4 (3rd up from bottom) with the others dark, a 100% dimmer level will illuminate all of them.

The second if (!dimmer_vals.is_on()) will turn off all the LEDs when the light is off.

Although it looks a bit like a kludge, it is a rather elegant/compact method to achieve that.

This setup is working great for me! Thanks for the config file. OTA isn’t working for me though and I’m not sure what’s going on. If I directly flash it, it works correctly, but if I do an OTA flash as an update it never reconnects to the wifi. Any suggestions?

I just got two of these martin jerry wifi dimmer swithes from amazon.

From people’s experience is it best to go with tasmota or esphome? I’m familiar with both.

I’ve used both and prefer esphome. The response of the switch when operating manually seems much snappier with esphome. With Tasmota there was lag when turning it on and off (especially off) that bugged me. I don’t get this with my esphome config, response is instant.

1 Like

If I don’t have a spare Pi is there an easy way to get tasmota or esphome onto the martin jerry wifi dimmer using OTA flashing? I have a windows PC and android phone. Alternatively I do have a FTDI USB adapter for hardwired flashing.

Is this currently the recommended code for esphome usage?

Thanks for all the info. I have my MJ-SD02 dimmer working and connected. My only concern is when I turn off the lights. Whether via home assistant or the actual button, the lights dim then turn off. I want to behavior to be instant off (without dimming). Is this possible? Thanks…

Adjust the default_transition_length in the light section… but…

Mine is set to 0 but I still get just a touch of down dimming when I turn the light off…less than a second in length then the relay turns it completely off. I think that’s the best you can get since you are controlling the esphome light object instead of a switch object.

Is it possible to use this dimmer with Tasmota? I don’t see a template or a module for either. Successfully managed to get it flashed and working with MQTT.

However, I’ve already bricked 1 of the 5 trying to go down the ESPHome route and would prefer to just stick with Tasmota before I fry another. Really frustrated with myself at the moment. Any guidance would be greatly appreciated.

Yes. http://www.thesmarthomehookup.com/dimmers/sold-as-martin-jerry/

That’s awesome @markm. Thank you.

Unfortunately, it still didn’t make any difference though. I entered the values and the console commands specified exactly as written and the dimmer still doesn’t turn the light on.

backlog 
setoption32 10; 
switchmode1 6; 
switchmode2 5; 
switchmode3 5;
rule1 on switch3#state=2 do dimmer + endon 
on switch2#state=2 do dimmer - endon 
on dimmer#state do VAR1 %value% endon
on VAR1#state>19 do power2 1 endon 
on VAR1#state<20 do power2 0 endon 
on VAR1#state>39 do power3 1 endon 
on VAR1#state<40 do power3 0 endon 
on VAR1#state>59 do power4 1 endon 
on VAR1#state<60 do power4 0 endon 
on VAR1#state>79 do power5 1 endon 
on VAR1#state<80 do power5 0 endon;
rule1 1;
backlog 
rule2 on Power1#State=0 do power1 0 endon 
on Power1#State=0 do power2 0 endon 
on Power1#State=0 do power3 0 endon 
on Power1#State=0 do power4 0 endon 
on Power1#State=0 do power5 0 endon 
on Power1#State=1 do VAR1 %var1% endon; 
rule2 1;

Any suggestions?

Mine:

Smart Home Hookup:

Very odd. Perhaps try setting the Based On to Generic (18) instead of Sonoff Basic?

I know the settings I linked do work, as I was using those with Tasmota before switching to esphome (a while ago on older Tasmota release).

Also, sometimes when switching between Tasmota and esphome, I had to reset the switch (push small button under the switch paddle or cycle the breaker at the box). May want to try that if you haven’t already.

I’m also curious about esphome bricking one of your devices. What version of esphome are you using?

Thanks for the suggestions @markm. Unfortunately, nothing worked.

I was however able to flash the switch that I thought I’d bricked and the remainder with esphome and all is well now. :slight_smile:

@mjoshd @markm is there any way to adjust the 2-3 second delay that’s occurring when I turn the switch off?

Also, is it possible to set the lowest brightness level any lower in the yaml? The NodeRed levels that I had been using with the Tuya firmware seem to have allowed brightness to get much dimmer than what I’m now able to do with esphome.

I just checked on my dimmer multiple times using the stopwatch on my phone and the delay from pushing the power button to the lights actually turning off is ~1.5-1.7 seconds. During that time they dim to their absolute minimum brightness, pause very briefly, then turn off. You may get very different results with different bulbs. I am currently using 6 Philips LED bulbs with the dimmer.

As for the minimum brightness, try lowering the pwm_min_power: in the substitutions section. Below 15% power my current bulbs turn off and the previous bulbs worked all the way down to 7%; that’s why the setting exists. Again, different results with different bulbs.

Did you ever write your hue modification? I’m in a similar situation and use hue bulbs. I just got a Martin Jerry switch that I want to flash with esphome

Will this code work on SD02? Got some coming just wanted to know before I tried. :wink: Thanks

No idea. Looks like everything is still there (side indicator lights, 3 buttons, main power light) but I’ve not tried that model yet.

Here’s a link to the Tasmota template page; at first glance it appears compatible but you should definitely double check for yourself.

You should be able to use the Tasmota info to verify the GPIOs in the .yaml and remap them if required, then I think you’d be all set. Good luck and let us know how it goes!

1 Like

Has anyone tried Tasmota with one of the 3 way dimmers?

I have two of these, and the weird part is the LED on the remote doesn’t work the same on both switches…I kind of wonder if it is wired incorrectly, but that isn’t really relevant to using Tasmota with it.