Page 1 of 1

[Solved] Plobrem with GPIO after reset/reboot.

Posted: 23 Apr 2018, 21:24
by Sturgeon
Hello everyone!
I have a question. I connected relay module with 2 relays to wemos D1 with ESPEASY firmware. Created two switches. Connected to GPIO - 13 and 14. Manage through MQTT. Everything works fine. But i have a problem. After reboot/reset, one of the pins automaticaly set to "LOW". And after 1-2 seconds the relay starts working, but I don`t want it. I try enable internal pull-up, but is not usefull.
The first picture from MQTT-SPY. It shows how 2 second later reset pin 13 turn the value "0". Why is this happening? What am I doing wrong?

Hardware settings in the second image. The 3 and 4 image shows the device settings. GIT version: mega-20180323. I don't use rules .
2.jpg
2.jpg (149.86 KiB) Viewed 5713 times
3.jpg
3.jpg (89.26 KiB) Viewed 5713 times
4.jpg
4.jpg (124.9 KiB) Viewed 5713 times
1.jpg
1.jpg (72.53 KiB) Viewed 5709 times

Re: Plobrem with GPIO after reset/reboot.

Posted: 29 Apr 2018, 08:05
by Sturgeon
I try to update firmware. I try to change pin to gpio-4 and -5. I try to use internal pullup resistor. But problem stil is not solved.
I want to use 2-channel relay module through MQTT. All works fine. But after reboot last used gpio change it state automaticaly. Why this is happens?

My rule:

Code: Select all

on System#Boot do
GPIO,4,1
GPIO,5,1
endon 



on Curtains_open#Curtains_open=0 do
timerSet, 1, 3
endon

on Rules#Timer=1 do
gpio,4,1         // Turn off relay
Publish /ESPEasy_Bedroom_Curtains/Curtains_open,1
endon


on Curtains_close#Curtains_close=0 do
timerSet, 2, 3
endon

on Rules#Timer=2 do
gpio,5,1         // Turn off relay
Publish /ESPEasy_Bedroom_Curtains/Curtains_close,0
endon

Re: Plobrem with GPIO after reset/reboot.

Posted: 03 May 2018, 10:45
by Sturgeon
So, problem is still not solved.
But I think that the reason for this in MQTT. When my PC (where install Mosquitto broker) is shutdown, ESP not run gpio on restart. When broker is working, last MQTT comand repeat after reboot/restart. What broker preferense can do this behavior?

Re: Plobrem with GPIO after reset/reboot.

Posted: 03 May 2018, 11:39
by grovkillen
Do you have the message retained activated?

Re: Plobrem with GPIO after reset/reboot.

Posted: 03 May 2018, 11:55
by Sturgeon
Do you have the message retained activated?
I start without MQTT Retain Msg flag. Then I try with this flag (For what? I dont know). Not difference.
MQTT spy see only one first message. After reset MQTT spy dont see any message to ESP.

Re: Plobrem with GPIO after reset/reboot.

Posted: 03 May 2018, 13:39
by danmero
Try GPIO 12 and 14 , or 4 and 5 if you don't use I2C.

Regards,

Re: Plobrem with GPIO after reset/reboot.

Posted: 03 May 2018, 14:39
by Sturgeon
danmero wrote: 03 May 2018, 13:39 Try GPIO 12 and 14 , or 4 and 5 if you don't use I2C.

Regards,
I begin with GPIO 12 and 14. Now I use GPIO 4 and 5 (D1 and D2 pin). Not difference.

Re: Plobrem with GPIO after reset/reboot.

Posted: 04 May 2018, 12:46
by Sturgeon
In OpenHab mqtt config file I change setting to:

mosquitto.retain=false

And problem solved.
Thanks for all!