Page 1 of 1

Sonoff 2 Gan GPIO,5 at 1 when reboot

Posted: 10 Dec 2019, 09:34
by fishton
Hello

I have just upgraded my Sonoff 2 gangs used for opening/closing my shuttters to EspEasy mega 20191130 version and I am experiencing an issue I have already seen in the past

Each time the sonoff restarts, GPIO 5 is set to 1 causing my blinds to close.

This was definitely not the case for earlier version I was using (2018-06 as far as I remember)

Do you know how I can prevent that to happen ?

thanks a lot
fishton

Re: Sonoff 2 Gan GPIO,5 at 1 when reboot

Posted: 10 Dec 2019, 12:00
by grovkillen
Have you tried setting boot state for that pin? It's found under the hardware tab.

Re: Sonoff 2 Gan GPIO,5 at 1 when reboot

Posted: 10 Dec 2019, 12:29
by fishton
Hi

I tried that in the past and it was not working so I rolled back to previous version but I must confess I didn't this time

I would really like staying with latest version with Wifi stability updates but if the blinds are closing few times a day won't be manageable :)

I will try putting LOW tonight

thanks
Fishton

Re: Sonoff 2 Gan GPIO,5 at 1 when reboot

Posted: 10 Dec 2019, 12:59
by grovkillen
Yeah try and get back here with info.

Re: Sonoff 2 Gan GPIO,5 at 1 when reboot

Posted: 11 Dec 2019, 10:22
by fishton
Hey !

So, I have been able to understand the issue here.

when the Sonoff Touch 2 gang is starting, it looks like Switch 2 (GPIO 9) is set to 1 that was triggering a rule based on that value changing and also changing the relay value

I have added :

on System#Boot do
gpio,12,0
gpio,5,0
inputswithcstate,1,0
inputswithcstate,0,0
endon

in the rules

and also changed both buttons to have "Internal PullUp"

and now I still see the switch 2 light showing up but no more relay activation and the light is switched off afterward

any thoughts ?

thanks
fishton

Re: Sonoff 2 Gan GPIO,5 at 1 when reboot

Posted: 11 Dec 2019, 10:46
by fishton
also I tried putting Low on GPIO 9 but it does no have any effect

Re: Sonoff 2 Gan GPIO,5 at 1 when reboot

Posted: 11 Dec 2019, 11:23
by TD-er
What build did you flash?
It should be ESP8285 and not ESP8266.
GPIO-9 is not available on ESP8266 as it is connected to an external flash chip. On the ESP8285 the flash chip is internal.

Re: Sonoff 2 Gan GPIO,5 at 1 when reboot

Posted: 11 Dec 2019, 12:32
by fishton
Hey

I flashed mega 20191208 normal ESP8285 :)

thanks

Re: Sonoff 2 Gan GPIO,5 at 1 when reboot

Posted: 12 Dec 2019, 00:49
by Domosapiens
fishton wrote:
11 Dec 2019, 10:22
on System#Boot do
gpio,12,0
gpio,5,0
inputswithcstate,1,0
inputswithcstate,0,0
endon
inputswithcstate,1,0
inputswithcstate,0,0
Typo .. must be inputswitchstate

Re: Sonoff 2 Gan GPIO,5 at 1 when reboot

Posted: 12 Dec 2019, 13:25
by fishton
indeed, typo

my rules below

on System#Boot do
event,STOP
endon

on Touch1#Switch1 do
if [Touch1#Switch1]=1 do
gpio,5,0
inputswitchstate 1,0
gpio,12,1
timerSet,1,30 //Set Timer 1 for the next event in 120 seconds
else
gpio,5,0
inputswitchstate 1,0
gpio,12,0
endif
endon

on Touch2#Switch2 do
if [Touch2#Switch2]=1 do
gpio,12,0
inputswitchstate 0,0
gpio,5,1
timerSet,2,30//Set Timer 1 for the next event in 120 seconds
else
gpio,12,0
inputswitchstate 0,0
gpio,5,0
endif
endon

On Rules#Timer=1 do
gpio,12,0
inputswitchstate 0,0
endon

On Rules#Timer=2 do //When Timer1 expires, do
gpio,5,0
inputswitchstate 1,0
endon

on UP do
gpio,5,0
gpio,12,1
inputswitchstate 0,1
inputswitchstate 1,0
timerSet,1,30
endon

on DOWN do
gpio,12,0
gpio,5,1
inputswitchstate 1,1
inputswitchstate 0,0
timerSet,2,30
endon

on STOP do
gpio,12,0
gpio,5,0
inputswitchstate 1,0
inputswitchstate 0,0
endon