Page 3 of 10

Re: Serial MCU controlled relay/switch

Posted: 21 Mar 2018, 22:37
by enesbcs
dent wrote: 21 Mar 2018, 21:28 I tried your suggestions and I am now able to command the switch and the leds on it trough GPIO commands. I set some rules, installed mqtt and now I am able to control the whole thing both physically and wireless.

I have also tried the 'hard way'. The hex output I see is "00" almost all the time when I press or hold the button. Is this normal or is "00" an error of some sort?
I have also purchased 2 and 3 gang versions and waiting for their delivery. I will let you know when I get them and try to find out their hex outputs.
I am glad that it helps, maybe you can publish the used GPIO numbers and rules for the others who are buying Kinco switches in Hardware topic. :)

I think:
1/ maybe 00 means "button 0" as it is the first and only button on this switch which is returned from the simple serial touch sensor - in which case this is absolutely not a Tuya compatible device - the Tuya protocol seems like "55aa 00 07 0005 01 01 00 01 01 0F". (in hex for the first button)
2/OR the serial baudrate setted in the ESPEasy did not match with the MCU builtin speed in which case the zeroes means nothing. 9600 and 19200 are the most popular default speeds with 8N1.

I did not find anything about this specific chip, however in the AR1000 touch controller datasheet there are a comment in the UART communication mentioning "Sleep mode will cause the TX line to drop low, which may appear as a 0x00 byte sent from the controller"

Re: Serial MCU controlled relay/switch

Posted: 03 Apr 2018, 19:37
by xury
Hello everybody.
I'm newbie on this forum, and totally beginner with platformio.
I'd like to ask tou how to compile this plugin on 2.3.0 core?
I got error:
:/ESPEasy-mega-20180402/src/_P165_SerSwitch.ino: In function 'boolean Plugin_165(byte, EventStruct*, String&)':
L:/ESPEasy-mega-20180402/src/_P165_SerSwitch.ino:481:16: error: 'class HardwareSerial' has no member named 'setRxBuffer
Size'

Re: Serial MCU controlled relay/switch

Posted: 04 Apr 2018, 07:38
by enesbcs
xury wrote: 03 Apr 2018, 19:37 Hello everybody.
I'm newbie on this forum, and totally beginner with platformio.
I'd like to ask tou how to compile this plugin on 2.3.0 core?
I got error:
:/ESPEasy-mega-20180402/src/_P165_SerSwitch.ino: In function 'boolean Plugin_165(byte, EventStruct*, String&)':
L:/ESPEasy-mega-20180402/src/_P165_SerSwitch.ino:481:16: error: 'class HardwareSerial' has no member named 'setRxBuffer
Size'
This plugin made for core 2.4.0rc2, 2.4.0rc1 or 2.4.0 stable.
Lack of setRxBuffer is the main reason i do not use previous cores, because for Tuya compatibility the buffer needs to be extended at least 100 bytes! I am serious, their transmitting al three button state every time when change occurs, even if the device only have one button or only one button state changed. If buffer is smaller than 3x33 bytes
that will cause very funny errors, for sure.
In core 2.3.0 the hardware serial buffer is defaulted to 32 bytes and can not be altered in the user space.

If you are desperately want to use the older, KRACK-affected 2.3 core, and DO NOT want to use Tuya, than be my guest, and try the following modifications with the plugin source (Dual and LCTech might work):

Modify:
#define BUFFER_SIZE 100
To:
#define BUFFER_SIZE 32

And comment out the two following lines:
//Serial.setDebugOutput(false);
//Serial.setRxBufferSize(BUFFER_SIZE);

Re: Serial MCU controlled relay/switch

Posted: 04 Apr 2018, 12:02
by xury
Thank You enesbcs
I will try to compile with your sugestions this evening when I come back home. I need it for lc tech relay so I hope should be good with buffer size 32.
I have one more request. Would you like give me a link for a core 2.4.0 source because as I said im totally beginner.
A don't know how to work with 2.4.0 in platformio without git.
Maby is a zip package with 2.4.0 enviroment to get easy way as in toutorial?

I also found a solution how to reflash lctech IC to get info about relay state.
https://www.esp8266.com/viewtopic.php?p=74262#p74262
From above post after reprogram chip we can use:
B0 01 01 B2 -> Reading relay in text format ("ON" and "OFF" ending with a linefeed).
B0 01 00 B1 -> Relay reading in binary format (00 = ON and 01 = OFF).

B0 00 01 B1 -> Reading the firmware version in text format ending with a linefeed.
Im succesfuly reprogram STC15F104W so I can confirm it's work properly

Re: Serial MCU controlled relay/switch

Posted: 04 Apr 2018, 15:13
by enesbcs
xury wrote: 04 Apr 2018, 12:02 A don't know how to work with 2.4.0 in platformio without git.
Maby is a zip package with 2.4.0 enviroment to get easy way as in toutorial?

B0 01 01 B2 -> Reading relay in text format ("ON" and "OFF" ending with a linefeed).
B0 01 00 B1 -> Relay reading in binary format (00 = ON and 01 = OFF).
B0 00 01 B1 -> Reading the firmware version in text format ending with a linefeed.
I am also do not know platformio, because i am compiling with Arduino:
https://github.com/esp8266/Arduino

I checked this user provided binary for the STM. The new commands is nice, but i am not sure what can i do with the nonstandard replies without headers? Also there are a two relay version of this device what about that?

Re: Serial MCU controlled relay/switch

Posted: 04 Apr 2018, 18:29
by xury
As your suggestion I managed to compile on 2.3.0 core. Plugin sims work OK but when I try add new device I have error in red frame:
I guess is a filesystem error. Maybe not enough flash? Or is wrong organization, because I had another version of firmware before.
I'll tray to disable some unneeded plugins for me and check again.
bladesp.png
bladesp.png (53.75 KiB) Viewed 94315 times

Re: Serial MCU controlled relay/switch

Posted: 16 Apr 2018, 01:09
by xury
Ok. I finally managed to compile with what I need.
It was a problem with PUYA chip.
After patching Esp.cpp it works well.

Re: Serial MCU controlled relay/switch

Posted: 24 Apr 2018, 23:45
by nygma
Hi Guys, I have used ESP Easy before, but so far I only uploaded the precompiled bins.
So to make this work for the LCTech relay board I need to compile my own version e.g. from Arduino? This also means that this core 2.4 is not the same as the 20180428 binary versions?
A slightly off topic question: I tried playing around with the ESP_Easy_mega-20180424_normal_ESP8266_1024.bin version (I have a black ESP-01 and not with the PUYA chip). I cannot get it to connect to the AP. I put the password in and nothing happens it comes back to setup. If I flash the older 147 build that works just fine. Any pointers?
Cheers,
Csongor

Re: Serial MCU controlled relay/switch

Posted: 25 Apr 2018, 18:41
by xury
If you want use another plugins not included in bin files shared at first post you have to compile using Arduino or Platformio.
About problems with new releases you mast observe serial output during connection and read logs data.

P.S I have request to enesbcs. If is possible to fix a plugin? On recent sources I have :" Bug in PLUGIN_WEBFORM_LOAD, should not append to string, use addHtml() instead" I cannot it fix myself.

Re: Serial MCU controlled relay/switch

Posted: 25 Apr 2018, 19:38
by enesbcs
nygma wrote: 24 Apr 2018, 23:45 Hi Guys, I have used ESP Easy before, but so far I only uploaded the precompiled bins.
So to make this work for the LCTech relay board I need to compile my own version e.g. from Arduino?
There are always precompiled binaries in the first post in this thread with P165 plugin, no need to compile, if you are not familiar with it. If you need a plugin that is not contained the binaries, name it.

Re: Serial MCU controlled relay/switch

Posted: 25 Apr 2018, 19:45
by enesbcs
xury wrote: 25 Apr 2018, 18:41 P.S I have request to enesbcs. If is possible to fix a plugin? On recent sources I have :" Bug in PLUGIN_WEBFORM_LOAD, should not append to string, use addHtml() instead" I cannot it fix myself.
I saw that WEBFORM_LOAD changes, i fixed it, but it also means that this plugin will not compile in ESPEasy R147 version, only the latest Mega edition.
https://github.com/enesbcs/ESPEasyPlugi ... Switch.ino

Re: Serial MCU controlled relay/switch

Posted: 27 Apr 2018, 16:00
by alabama
enesbcs wrote: 31 Aug 2017, 17:24
rira2005 wrote: 31 Aug 2017, 13:55 Bought this ESP8266 5 V WiFi relaismodul in china
https://de.aliexpress.com/item/ESP8266- ... 0.0.5Thz2C
it also works with a serial controled MCU... May you have a idea to get it work with easyesp?
I am sure that it can be done. But first we need to know the commands, that the ESP-01 is sending to drive the relay ON/OFF state.

I see the serial speed is: 9600,8,1,0,0.

And i've found a fantastic article by makerrelay:
https://www.hackster.io/makerrelay/esp8 ... ome-e8a437

According to it:
A00101A2 open relay,
A00100A1 closed relay

If you're willing to try, i can make a test binary with the above commands, but there is no guarantee. :)

Update: attached 1M/128k SPIFFS for black ESP-01
Please let me refer to this some months old post. Is it right that you have made a binary to download? If yes, is it possible to get it?
Thanks.

Re: Serial MCU controlled relay/switch

Posted: 27 Apr 2018, 18:53
by enesbcs
alabama wrote: 27 Apr 2018, 16:00
enesbcs wrote: 31 Aug 2017, 17:24 And i've found a fantastic article by makerrelay:
https://www.hackster.io/makerrelay/esp8 ... ome-e8a437

According to it:
A00101A2 open relay,
A00100A1 closed relay

If you're willing to try, i can make a test binary with the above commands, but there is no guarantee. :)

Update: attached 1M/128k SPIFFS for black ESP-01
Please let me refer to this some months old post. Is it right that you have made a binary to download? If yes, is it possible to get it?
Thanks.
Yes, as i mentioned on several occasions, that every binary is attached at the first post of this thread:
viewtopic.php?p=16998#p16998

Re: Serial MCU controlled relay/switch

Posted: 29 Apr 2018, 18:55
by alabama
Ok - thanks.
(Sometimes I'm wondering myself,why don't I get the simplest ideas?? ;) )

Re: Serial MCU controlled relay/switch

Posted: 30 Apr 2018, 02:36
by alabama
Again: Thanks a lot for this. It works wunderfull!

Re: Serial MCU controlled relay/switch

Posted: 30 Apr 2018, 07:37
by enesbcs
You're welcome. In the meantime i also bought an LCTech relay, but a 12V version which is also works with the same commands. But some reason it only works reliable with 115200 baud setting.
Older models speed was 9600 baud at default.

Re: Serial MCU controlled relay/switch

Posted: 30 Apr 2018, 10:24
by alabama
Now I have seen that my post was to fast: Wit the original ESP8266-01 it seems not to work. But if I change with another one it works. The only difference I saw up to now is that there is the writing "AI-Cloud inside" on that one wich works and not on that one which not works. Further it seems it's only possible to flash R120 on the original. Today I made a test with my second Rely-Modul ans again I can't flsh neither your FW nor the other 2.x.

I think it is the ESP8266-01 the reason, but I have to continue my tests.

Re: Serial MCU controlled relay/switch

Posted: 30 Apr 2018, 14:28
by enesbcs
alabama wrote: 30 Apr 2018, 10:24 Now I have seen that my post was to fast: Wit the original ESP8266-01 it seems not to work. But if I change with another one it works. The only difference I saw up to now is that there is the writing "AI-Cloud inside" on that one wich works and not on that one which not works. Further it seems it's only possible to flash R120 on the original. Today I made a test with my second Rely-Modul ans again I can't flsh neither your FW nor the other 2.x.

I think it is the ESP8266-01 the reason, but I have to continue my tests.
Puya SPIFF error is an old story. I did not patched ...1M_128kS.bin, instead from P165_19.zip use ESPEasy_R147_1M_64kS.bin this is not affacted by Puya, i am using this version also.

Re: Serial MCU controlled relay/switch

Posted: 30 Apr 2018, 21:31
by alabama
Ok, seems you are right. The second one of the modules is working now.

Re: Serial MCU controlled relay/switch

Posted: 30 Apr 2018, 23:51
by xury
If someone would like test it. Compiled using recent sources (core 2.4.1)
I compiled it with PUYA patched Esp.cpp
It should by work with differ than PUYA flash IC too.
To fit in 1MB II got rid of some plugins that I think it can not be used with serial controlled boards.

Re: Serial MCU controlled relay/switch

Posted: 01 May 2018, 08:38
by enesbcs
xury wrote: 30 Apr 2018, 23:51 If someone would like test it. Compiled using recent sources (core 2.4.1)
I compiled it with PUYA patched Esp.cpp
It should by work with differ than PUYA flash IC too.
To fit in 1MB II got rid of some plugins that I think it can not be used with serial controlled boards.
Nice work! Did you used the latest Mega sources to compile?
Finally I am also able to apply puya patch and compiled some binaries (with P165) for testing, attached on the first post of this thread.

Re: Serial MCU controlled relay/switch

Posted: 01 May 2018, 10:41
by xury
Yes, I used sources from yesterday and patched Esp.cpp and obviously your nice plugin.
Working well witch domoticz ESP-01s and LC TECH single relay.
Added a button and some rules to get full feedback about relay state.

Code: Select all

on sonoff#Relay0 do
Publish domoticz/in,{"idx":92,"nvalue":[sonoff#Relay0],"svalue":""}
endon

on Przycisk#switch do

if [sonoff#Relay0]=1
relay,0,0
else
relay,0,1
endif
endon
Przycisk is a name of switch input connected between GPIO-2 and GND Switch type" Push button active low" with internal pullup.
Whatever I use to change relay state (button, external command etc.) Its show always real state in domoticz.

Re: Serial MCU controlled relay/switch

Posted: 01 May 2018, 11:31
by alabama
I'm successfull with 3 of 4 Module with ESPEasy_R147_1M_64kS. The forths also first works fine until I tried to change the IP-settings. After that I can reach it. Even after several successful flashes with different FWs it is not visible in the WLAN. I'm not so really a profi in this topic, but I'm wondering that the simple change of the IP-settings can have this effect.
Next I'll try the version of @xury.

EDIT:
Wonderfull, the problematic ESP8266-01 is running now, with the changed IP configuration and with the FW of @xury. Now I have to connet it with the relay.

Thanks a lot both of you!

Re: Serial MCU controlled relay/switch

Posted: 04 May 2018, 01:18
by qingz
I bought 4 relays from AliExpress from this user.
https://www.aliexpress.com/item/ESP8266 ... 88295.html

None of them works.
I tried send the serial command A00101A2 and A00100A1 in hex to the device directly from my computer using the utility downloaded from LCTech. No response from the relay.
I probed the signals on the serial port with a oscilloscope, they looks perfect.

Is it possible the relays are faked? The MCU on the relay does not work? Or it takes a different command?

I'm totally lost.

Re: Serial MCU controlled relay/switch

Posted: 04 May 2018, 06:59
by enesbcs
qingz wrote: 04 May 2018, 01:18 I bought 4 relays from AliExpress from this user.

Is it possible the relays are faked? The MCU on the relay does not work? Or it takes a different command?
There are several devices on the wild which is not programmed, you need a programmer, the STC15F104W microprograms can be found at:
https://www.esp8266.com/viewtopic.php?f ... =68#p74262

Re: Serial MCU controlled relay/switch

Posted: 04 May 2018, 08:11
by qingz
enesbcs wrote: 04 May 2018, 06:59
qingz wrote: 04 May 2018, 01:18 I bought 4 relays from AliExpress from this user.

Is it possible the relays are faked? The MCU on the relay does not work? Or it takes a different command?
There are several devices on the wild which is not programmed, you need a programmer, the STC15F104W microprograms can be found at:
https://www.esp8266.com/viewtopic.php?f ... =68#p74262
That's should be exactly what happened to my relays. I contacted LCTech, and they said those relays were not made by them.
I will try to program them.

Thank you!

Re: Serial MCU controlled relay/switch

Posted: 04 May 2018, 15:33
by qingz
Is there a way to read our the binary code from MCU of the official LCTech product and use it to program my relays?

Re: Serial MCU controlled relay/switch

Posted: 05 May 2018, 03:56
by qingz
qingz wrote: 04 May 2018, 08:11
enesbcs wrote: 04 May 2018, 06:59
qingz wrote: 04 May 2018, 01:18 I bought 4 relays from AliExpress from this user.

Is it possible the relays are faked? The MCU on the relay does not work? Or it takes a different command?
There are several devices on the wild which is not programmed, you need a programmer, the STC15F104W microprograms can be found at:
https://www.esp8266.com/viewtopic.php?f ... =68#p74262
That's should be exactly what happened to my relays. I contacted LCTech, and they said those relays were not made by them.
I will try to program them.

Thank you!
Programmed the MCU of relay with the hex code from the post. And the relay works now. Well, sort of.
The LED works, it turns on and off with the on/off command, but the relay does not switch.

The problem is that the R3 is too big. It is 10K instead of 4.7K from LCTech. Once I changed it to 4.7K, it worked.
Screenshot_1.jpg
Screenshot_1.jpg (16.83 KiB) Viewed 95991 times

Re: Serial MCU controlled relay/switch

Posted: 05 May 2018, 16:35
by enesbcs
qingz wrote: 05 May 2018, 03:56 Programmed the MCU of relay with the hex code from the post. And the relay works now. Well, sort of.
The LED works, it turns on and off with the on/off command, but the relay does not switch.

The problem is that the R3 is too big. It is 10K instead of 4.7K from LCTech. Once I changed it to 4.7K, it worked.
Nice work! I know that counterfeit's sometimes missing software, but never tought that they are incompatible at hardware level. If i were you, i would ask for refund.

Re: Serial MCU controlled relay/switch

Posted: 06 May 2018, 05:06
by qingz
enesbcs wrote: 05 May 2018, 16:35
qingz wrote: 05 May 2018, 03:56 Programmed the MCU of relay with the hex code from the post. And the relay works now. Well, sort of.
The LED works, it turns on and off with the on/off command, but the relay does not switch.

The problem is that the R3 is too big. It is 10K instead of 4.7K from LCTech. Once I changed it to 4.7K, it worked.
Nice work! I know that counterfeit's sometimes missing software, but never tought that they are incompatible at hardware level. If i were you, i would ask for refund.
Less than $5 for 4. Not worth the hassle to ask for refund.

Re: Serial MCU controlled relay/switch

Posted: 07 May 2018, 23:27
by nygma
xury wrote: 30 Apr 2018, 23:51 If someone would like test it. Compiled using recent sources (core 2.4.1)
I compiled it with PUYA patched Esp.cpp
It should by work with differ than PUYA flash IC too.
To fit in 1MB II got rid of some plugins that I think it can not be used with serial controlled boards.
Hi Xury,

I have an LCTech Relay X2 (2 relay module). The stock firmware on the MCU and ESP worked, I was able to control the relays with HEX codes over TCP. I flashed your ESPEasy_1M_128kSPIFFS_PUYA.bin to the ESP-01 (not a PUYA chip). ESP Easy works. I configured it in the following way:
Device: Serial MCU controlled switch
Name: Relay
Enabled: X
Switch type: LC TECH
Number of Relays: 2
Serial speed: 9600
Use command doubling: NO
Send to Controller: X
Interval: 0
Names: Relay0, Relay1, Relay2

I also configured a OpenHAB MQTT controller. I am trying to send 0 and 1 to /LCTech/Relay/Relay0 but nothing happens. The device and MQTT definitely works as I am getting the RSSI and update messages from the System Info devices that I have also created. When I am sending the MQTT messages to the above relay topics, nothing is appearing in the Log.

How can I check this further? Can I switch the relays from the Webserver?

Thanks,
Csongor

Re: Serial MCU controlled relay/switch

Posted: 08 May 2018, 07:05
by enesbcs
nygma wrote: 07 May 2018, 23:27
I have an LCTech Relay X2 (2 relay module). The stock firmware on the MCU and ESP worked, I was able to control the relays with HEX codes over TCP. I flashed your
...
I also configured a OpenHAB MQTT controller. I am trying to send 0 and 1 to /LCTech/Relay/Relay0 but nothing happens. The device and MQTT definitely works as I am
...
How can I check this further? Can I switch the relays from the Webserver?
You have to implement MQTT support if you wish to use it.

Currently the plugin can be used with the following commands:

The ON command for Relay0:
relay,0,1
The OFF command for Relay0:
relay,0,0
The ON command for Relay1:
relay,1,1
The OFF command for Relay1:
relay,1,0

Commands can be executed on the web interface directly, or in a user-written RULE, or with a HTTP URL:
http://ESPEASY_IP/control?cmd=relay,0,1

Or command through MQTT (from ESPEasy wiki)
<MQTT subscribe template>/cmd with payload: <command>

Re: Serial MCU controlled relay/switch

Posted: 08 May 2018, 07:31
by nygma
enesbcs wrote: 08 May 2018, 07:05
You have to implement MQTT support if you wish to use it.

Currently the plugin can be used with the following commands:

The ON command for Relay0:
relay,0,1
The OFF command for Relay0:
relay,0,0
The ON command for Relay1:
relay,1,1
The OFF command for Relay1:
relay,1,0

Commands can be executed on the web interface directly, or in a user-written RULE, or with a HTTP URL:
http://ESPEASY_IP/control?cmd=relay,0,1

Or command through MQTT (from ESPEasy wiki)
<MQTT subscribe template>/cmd with payload: <command>
Is it possible that this 2 relay module is somehow different? I tried the HTTP commands. First of all there is no HTTP response (empty head and body) (I am not sure if that is intentional or not).

I see the following in the log after I issue the HTTP command:
228095 : EVENT: Relay#Relay0=1.00
228097 : EVENT: Relay#Relay0=1.00 Processing time:2 milliSeconds
228098 : EVENT: Relay#Relay1=1.00
228099 : EVENT: Relay#Relay1=1.00 Processing time:1 milliSeconds
228100 : EVENT: Relay#Relay2=0.00
228101 : EVENT: Relay#Relay2=0.00 Processing time:2 milliSeconds
228110 : MQTT : /LCTech/Relay/Relay0 1
228110 : MQTT : /LCTech/Relay/Relay1 1

I am not sure why there are relay 0, 1 and 2 when I have configured that I only have 2 relays. But I guess that should not cause any issues.

Re: Serial MCU controlled relay/switch

Posted: 08 May 2018, 07:46
by enesbcs
nygma wrote: 08 May 2018, 07:31 Is it possible that this 2 relay module is somehow different? I tried the HTTP commands. First of all there is no HTTP response (empty head and body) (I am not sure if that is intentional or not).
...
I am not sure why there are relay 0, 1 and 2 when I have configured that I only have 2 relays. But I guess that should not cause any issues.
Yes, there are multiple variants of this relay, some of them also have hardware bugs. (power supply inefficient so they auto restart when relay is on)
relay number 0 is always the first relay, and 1 is the second one on every supported device, it does not matter how you name it - the commands using their hardwired number.
There will be no HTTP response, we never know if the command is succesfully completed, because there are absolutely no answer from the device, nor any option to check the relay active status. I can modify the code the output some meaningless text, such as "command completed", if anybody need it.
riker1 wrote: 30 Jan 2018, 08:37 Now I can switch relay with 115200 baut.
According to riker 115200 baud is the necessary setting. Save than power off&power on the device, and check if it works. If nothing helps you can try other speeds, and for last resort: command doubling.

Re: Serial MCU controlled relay/switch

Posted: 08 May 2018, 08:34
by nygma
enesbcs wrote: 08 May 2018, 07:46 According to riker 115200 baud is the necessary setting. Save than power off&power on the device, and check if it works. If nothing helps you can try other speeds, and for last resort: command doubling.
WOW, man, it works! Thank you very much! Let me add a post here with the exact settings for anyone who comes around next time.

Re: Serial MCU controlled relay/switch

Posted: 08 May 2018, 09:13
by enesbcs
nygma wrote: 08 May 2018, 08:34 WOW, man, it works! Thank you very much! Let me add a post here with the exact settings for anyone who comes around next time.
Nincs mit. Nyugodtan posztold ide a beállításokat, jellemzően úgyse olvasnak vissza, inkább kérdeznek. :)

Re: Serial MCU controlled relay/switch

Posted: 08 May 2018, 09:18
by nygma
enesbcs wrote: 08 May 2018, 09:13 Nincs mit. Nyugodtan posztold ide a beállításokat, jellemzően úgyse olvasnak vissza, inkább kérdeznek. :)
:D Igen, és én is ilyen vagyok

Re: Serial MCU controlled relay/switch

Posted: 08 May 2018, 09:29
by nygma
This for anyone who would like to setup ESP Easy for a LCTech Relay X2 board. Thanks for the guys here for making this happen and helping me getting it working with my relay board.
I got mine from ICStation.com: http://www.icstation.com/esp8266-wifi-c ... 12593.html

My model came with a ESP-01 NOT with a PUYA flash chip. But the firmware is PUYA compatible, so it should work with an ESP-01 with PUYA :D

This is how my board looks like:
IMG_20180508_085722.jpg
IMG_20180508_085722.jpg (383.79 KiB) Viewed 106121 times
And the back of the board:
IMG_20180508_085740.jpg
IMG_20180508_085740.jpg (411.79 KiB) Viewed 106121 times
Flash ESPEasy_1M_128kSPIFFS_PUYA.bin firmware to the ESP-01. You can find the link to the firmware on Page 12 post #120 of this thread.

Perform the basic settings of the ESP Easy (wifi, etc.)
I set LCTech as my unit name (it will be important for MQTT later):
Esp_main.png
Esp_main.png (19.79 KiB) Viewed 106121 times
Add the following in the Device section:
ESP_device.png
ESP_device.png (53.75 KiB) Viewed 106121 times
Of course your can rename the Relay0, Relay1 names at the bottom. Ignore Relay2.

I set up MQTT with the following settings:
esp_controller.png
esp_controller.png (50.08 KiB) Viewed 106121 times
Save the settings and power cycle the relay board. When I power up the board, the red LED (D7) is lit and after a few seconds the green LED (D6) starts flashing. And it will stay that way. The board is ready to receive commands. So far I am controlling it via HTTP and MQTT the following way:

HTTP commands:
Relay 0 Off: http://ESP_IP/control?cmd=relay,0,0
Relay 0 On: http://ESP_IP/control?cmd=relay,0,1
Relay 1 Off: http://ESP_IP/control?cmd=relay,1,0
Relay 1 On: http://ESP_IP/control?cmd=relay,1,1

MQTT commands:
Topic: /LCTech/cmd (of course this may change depending on the Unit name)
Payload:
Relay 0 Off: relay,0,0
Relay 0 On: relay,0,1
Relay 1 Off: relay,1,0
Relay 1 On: relay,1,1

With the above setup, you will be getting MQTT messages on /LCTech/Relay/Relay0 or /LCTech/Relay/Relay1 topic with payload of 0 or 1 when the relay status is changed either via HTTP or MQTT. There is no status message back via HTTP. Keep in mind that this is not based on the actual status of the relay, as the MCU is not sending status information / confirmation back to ESP.

Re: Serial MCU controlled relay/switch

Posted: 08 May 2018, 21:41
by angelo67
Hello,
I have problems with the configuration, post programming
Configure the wifi connection, I wait for 20 seconds but when I try again
I do not go ahead, I always stay in the wifi configuration.
What programmer should I use for flash esp-01?
sorry for my english, I use google translator.
thank you

Re: Serial MCU controlled relay/switch

Posted: 09 May 2018, 08:11
by enesbcs
angelo67 wrote: 08 May 2018, 21:41 I have problems with the configuration, post programming
Configure the wifi connection, I wait for 20 seconds but when I try again
I do not go ahead, I always stay in the wifi configuration.
What programmer should I use for flash esp-01?
I used a CP2102 (not FTDI) in such connections to program it:
Image
with DOUT mode and of course with the proper PUYA-safe binary.
If it stays in wifi config mode after programming, than power off&power on the module and retry.

Re: Serial MCU controlled relay/switch

Posted: 09 May 2018, 12:14
by xury
enesbcs wrote: 08 May 2018, 07:46 I can modify the code the output some meaningless text, such as "command completed", if anybody need it.
if it was not a problem, I would ask for such function because Domoticz need any response otherwise shows error.
It would be nice if the response would be in JSON format.
Üdvözlet Lengyelországból.

Re: Serial MCU controlled relay/switch

Posted: 09 May 2018, 14:03
by angelo67
Hi,
I used a CP2102 (not FTDI) in such connections to program it:
http://m.blog.hu/bi/bitekmindenhol/imag ... rele_2.jpg
with DOUT mode and of course with the proper PUYA-safe binary.
If it stays in wifi config mode after programming, than power off&power on the module and retry.

This is good?
https://www.ebay.it/itm/Convertitore-Se ... SwZ2Na8bKJ

and wich programmer software you use??

Re: Serial MCU controlled relay/switch

Posted: 09 May 2018, 16:09
by enesbcs
angelo67 wrote: 09 May 2018, 14:03 and wich programmer software you use??
esptool and nodemcu-pyflasher

Re: Serial MCU controlled relay/switch

Posted: 09 May 2018, 23:47
by angelo67
Whats the different to the file
ESPEasy_Mega_P165_1M_128kS_lwip20_PUYA.bin
and
ESPEasy_Mega_P165_1M_128kS_lwip14_PUYA.bin

Re: Serial MCU controlled relay/switch

Posted: 10 May 2018, 08:45
by enesbcs
angelo67 wrote: 09 May 2018, 23:47 Whats the different to the file
ESPEasy_Mega_P165_1M_128kS_lwip20_PUYA.bin
and
ESPEasy_Mega_P165_1M_128kS_lwip14_PUYA.bin
The first was compiled with the newer lwIP 2.0 stack, the other compiled with the old lwIP 1.4. The older supposed to be more stable, but you can try and see. :)

Re: Serial MCU controlled relay/switch

Posted: 10 May 2018, 22:29
by enesbcs
xury wrote: 09 May 2018, 12:14 if it was not a problem, I would ask for such function because Domoticz need any response otherwise shows error.
Fair enough, Domoticz really shows an error, if reply did not arrive to the GET command. Now i am replying with an "OK" message, Domoticz error message disappeared.
xury wrote: 09 May 2018, 12:14 It would be nice if the response would be in JSON format.
Exactly what JSON message did you mean, and for what purpose? Domoticz did not care about replies from "Switch" devices as i see.

Re: Serial MCU controlled relay/switch

Posted: 11 May 2018, 14:20
by xury
Yes you have right. Domoticz does not care about switch reply.
So simply OK will be good.

Re: Serial MCU controlled relay/switch

Posted: 18 May 2018, 22:25
by angelo67
Hi
now whit the CP2102 its ok
but one error :"Md5 check Fail!"
look the part of info page
Build 20102 - Mega
Libraries ESP82xx Core 2_4_1, NONOS SDK 2.2.1(cfd48f3), LWIP: 2.0.3
GIT version (custom)
Plugins 12 [Normal] [Testing] [Development]
Build Md5 4d44355f4d44355f4d44355f4d44355f
Md5 check fail !
Build time May 10 2018 21:39:17"

Re: Serial MCU controlled relay/switch

Posted: 19 May 2018, 00:23
by enesbcs
angelo67 wrote: 18 May 2018, 22:25 but one error :"Md5 check Fail!"
Maybe i have to inject somehow md5 hash into "runTimeMD5" after compiling, but honestly i I do not see its practical significance.
Until appearing more detailed information in here:
https://www.letscontrolit.com/wiki/inde ... are_Upload
this bug stays in "wontfix" category.
Or i will simply delete it completly before compiling if it will be annoying. :)

Re: Serial MCU controlled relay/switch

Posted: 17 Jun 2018, 13:21
by countcobolt
Hi all,

I just received a Jinvoo dual switch. I would like to install the ESP firmware yet I do not find any empty pin headers... Has anyone experience with flashing this device? Below are the pictures of the PCB board.
The attachment 20180617_131709.jpg is no longer available
20180617_131709.jpg
20180617_131709.jpg (3.88 MiB) Viewed 104095 times
In case someone already flashed it, which binary file did you use?

Kind regards

Steve