Logo
Moes MS-104B-1 Relay
Moes MS-104B-1

Available from:
Banggood.com




Manufacturer:
Moeshouse.com


GPIO #Component
GPIO00 None
GPIO01 None
GPIO02 Button1
GPIO03 None
GPIO04 Buzzer
GPIO05 None
GPIO09 None
GPIO10 None
GPIO12 Counter2
GPIO13 Counter1
GPIO14 Relay1
GPIO15 Relay2
GPIO16 None
FLAG None

Template

{"NAME":"Moes MS-104B","GPIO":[0,0,17,0,160,0,0,0,43,42,21,22,0],"FLAG":0,"BASE":18}

Some devices labelled Moes MS-104 are using a wi-fi chip unsupported by Tasmota.

The device use frequency detection circuits connected to GPIO12 and GPIO13 of the LM1 ESP8266 chip.

There are two ways to use this module with Tasmota. One way is to modify Tasmota sources with very simple instructions and another way to use scripts.

For the first way, see simple instructions here or watch the video on Youtube. These instructions were created by Rok Rodic.

Another way to do similar thing is to use scripts. Script is not supported with precompiled binary (at least 8.3) so you have to compile your own fw or download it (tasmota-scripting.bin) from tasmota/binaries. After that, you will have an option to add a script in Tasmota GUI: Configuration/Edit Script Below are scripts which do something like switchmode4, switchmode1 and switchmode0. The script for switchmode4 is created by @thxthx0, switchmode1 @caccia78 and @cHunter789, switchmode0 @antonio-fiol

SwitchMode1

>D
sw1=0
sw2=0
cnt1=0
cnt2=0
pwr1=0
pwr2=0

>B
=>print "WiFi - 2 relay / 2 switch"
;sleep 250 because counters are sleep sensitive
->sleep 250
>F
; Always reset counters - consider only counts in last 100ms
cnt1=pc[1]
->Counter1 0

cnt2=pc[2]
->Counter2 0

if cnt1>3
then
; counter1 has increased in last 100ms - check with >2 for debounce
sw1=1
else
; no counter incres --> switch is off
sw1=0
endif

if cnt2>3
then
; counter2 has increased in last 100ms - check with >2 for debounce
sw2=1
else
; no counter increas --> switch is off
sw2=0
endif

; turn on the light if switches on
if sw1==1
and pwr1==0
then
=>Power1 1
pwr1=1
endif

if sw2==1
and pwr2==0
then
=>Power2 1
pwr2=1
endif

;turn off the light if switches off
if sw1==0
and pwr1==1
then
=>Power1 0
pwr1=0
endif

if sw2==0
and pwr2==1
then
=>Power2 0
pwr2=0
endif




SwitchMode4

>D
sw1=0
sw2=0
cnt1=0
cnt2=0
timer1=0
timer2=0
toggle1=0
toggle2=0

>B
=>print ""WiFi 2-Gang Switch Script""

>F
; Counter1/2 and Relay1/2 configured in template
cnt1=pc[1]
cnt2=pc[2]

if chg[cnt1]>0
then
; counter1 has changed, switch is on
sw1=1
else
; no change switch is off
sw1=0
endif

if chg[cnt2]>0
then
; counter2 has changed, switch is on
sw2=1
else
; no change switch is off
sw2=0
endif

; 100 ms timer
timer1+=1
timer2+=1

if sw1==0
and timer1>2
and timer1<30
then
;=>print short press1
toggle1^=1
=>Power1 %toggle1%
endif

if sw1==0
then
timer1=0
endif

if sw2==0
and timer2>2
and timer2<30
then
;=>print short press2
toggle2^=1
=>Power2 %toggle2%
endif

if sw2==0
then
timer2=0
endif

>S
; restart the device every sunday at 04:00
; to avoid possible issues when increasing counters and variables

if wday==1
and hours==4
and mins==0
and secs==0
then
->Restart 1
endif

SwitchMode 0

>D
sw1=0
sw2=0
osw1=0
osw2=0
M:cnt1=0
M:cnt2=0
np=0

>B
=>print ""WiFi 2-Gang Switch Script""

>F
; Counter1/2 and Relay1/2 configured in template
cnt1=pc[1]
cnt2=pc[2]
cnt1=pc[1]
cnt2=pc[2]
cnt1=pc[1]
cnt2=pc[2]
->Counter1 0
->Counter2 0

if cnt1>2.5
then
; counter1 has changed, switch is on
sw1=1
else
; no change switch is off
sw1=0
endif

if cnt2>2.5
then
; counter2 has changed, switch is on
sw2=1
else
; no change switch is off
sw2=0
endif

;=>print %cnt1% %sw1% %osw1% %pwr[1]%

if sw1!=osw1
then
osw1=sw1
if pwr[1]==0
then
np=1
else
np=0
endif
=>Power1 %np%
=>print Power1 %np%
endif

if sw2!=osw2
then
osw2=sw2
if pwr[2]==0
then
np=1
else
np=0
endif
=>Power2 %np%
=>print Power2 %np%
endif

>S
; restart the device every sunday at 04:00
; to avoid possible issues when increasing counters and variables

if wday==1
and hours==4
and mins==0
and secs==0
then
->Restart 1
endif

flash_pins rewers_site