Sonoff 4CH Pro Questions - Odd problem

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
User avatar
Methuselah
Normal user
Posts: 45
Joined: 04 Feb 2018, 01:39
Location: Boston, MA

Sonoff 4CH Pro Questions - Odd problem

#1 Post by Methuselah » 04 Feb 2018, 02:03

I'm new to the world of ESPEasy. I want to build an electronic 12v system to control an external antenna switch for my ham radio shack. I picked up a Sonoff 4CH Pro, and it works great, but I have a couple of odd issues I'm encountering which is probably due to my lack of experience. Any feedback would be appreciated.

I have my unit configured as follows:

Version: ESPEasy mega 20180130

Controllers: none

Hardware:
- Wifi Status LED GPIO-LED GPIO-13(D7). Inversed LED unchecked.
- I2C interface: GPIO<->SDA: GPIO-4(d2), GPIO->SCL: GPIO-5(d1)
- SPI Interface: Init SPI unchecked
- GPIO Boot states: all pins set to "default".

Devices:
4 Switch input->Switch, named Button1/2/3/4, maps to GPIO 0/9/10/14 respectively. Switch-Type switch, button type: push button active low. Internal pullup checked, inversed logic & send boot state off, delay 0.

Rules:

Code: Select all

On System#Boot do
debug 4
GPIO,12,0
GPIO,5,0
GPIO,4,0
GPIO,15,0
endon

on Button1#Press do
if [Button1#Press]=1
gpio,12,0
else
gpio,12,1
endif
endon

on Button2#Press do
if [Button2#Press]=1
gpio,5,0
else
gpio,5,1
endif
endon

on Button3#Press do
if [Button3#Press]=1
gpio,4,0
else
gpio,4,1
endif
endon

on Button4#Press do
if [Button4#Press]=1
gpio,15,0
else
gpio,15,1
endif
endon
Notifications: None

I have S6 set to 1, K5 1-4 set to 1, and K6 1-4 set to 0.

Basically, in addition to controlling the unit remotely via http, I want to have the buttons configured so each button will toggle a relay.

My problem:

The unit boots ok. However, shortly after booting (maybe 60 seconds), LED4 will flash green briefly. Randomly (apparently), immediately after a green flash, I will see a:

SW : Switch state 0 Output value 0
EVENT: Button4#Press=0.00
ACT : gpio,15,1
SW : GPIO 15 Set to 1

Which toggles relay 4 on. After a random (seemingly) amount of time, I'll get another green flash on LED4, with another Event generated that turns off relay 4.

This process repeats ad infinitum.

few other things I should mention: the rules seem to work great otherwise, i can press buttons 1 through 4 and have relays 1 thru 4 turn on and off. And, of course, if the green light flashes and turns on relay 4, I can press button 4 to shut it off, but that sort of defeats the purpose since I need all four pins to create a 12v bcd matrix to feed to the antenna switch :(

So, my two questions are:

a. What is the green flash on LED4 indicative of, and
b. Any ideas on why this Event is being generated which simulates pressing button 4, when I'm not touching anything? Is there a setting I've missed or do not understand causing it?

Thank you everyone.
N00b to the world of ESPEasy, but I've been programming since the days of punch cards and paper tape :)

rol-rider
Normal user
Posts: 43
Joined: 02 Oct 2016, 12:36

Re: Sonoff 4CH Pro Questions - Odd problem

#2 Post by rol-rider » 05 Feb 2018, 01:57

sorry for my english (google translation)

check that relay 4 is not associated with a 433Mhz module.

(probe "oregon 433Mhz" for example)
sorry for my English ! i use google translat.

User avatar
Methuselah
Normal user
Posts: 45
Joined: 04 Feb 2018, 01:39
Location: Boston, MA

Re: Sonoff 4CH Pro Questions - Odd problem

#3 Post by Methuselah » 05 Feb 2018, 15:11

rol-rider wrote: 05 Feb 2018, 01:57 check that relay 4 is not associated with a 433Mhz module.
I flashed 20180203 yesterday, and changed my rules. In addition to defining my buttons as switches, I also defined each of the relays as a switch so I could monitor the GPIO state independently of the buttons (they would get out of sync with one another if I used a http command to toggle the relays.)

So, I had to disassociate GPIO15 from I2C SCL (which I think was the problem). Would still be nice to know what that green flash on the LED was, however.

New rules:

Code: Select all

on System#Boot do
GPIO,15,0
GPIO,12,0
GPIO,5,0
GPIO,4,0
endon

on Button1#Press do
   if [GPIO12#State] = 0
      GPIO,12,1
   else
      GPIO,12,0
   endif
endon

on Button2#Press do
   if [GPIO5#State]=0
      GPIO,5,1
   else
      GPIO,5,0
   endif
endon

on Button3#Press do
   if [GPIO4#State]=0
      GPIO,4,1
   else
      GPIO,4,0
   endif
endon

on Button4#Press do
   if [GPIO15#State]=0
      GPIO,15,1
   else
      GPIO,15,0
   endif
endon

on Antenna1 do
      GPIO,12,0
      GPIO,5,0
      GPIO,4,0
endon

on Antenna2 do
      GPIO,12,1
      GPIO,5,0
      GPIO,4,0
endon

on Antenna3 do
      GPIO,12,0
      GPIO,5,1
      GPIO,4,0
endon

on Antenna4 do
      GPIO,12,1
      GPIO,5,1
      GPIO,4,0
endon

on Antenna5 do
      GPIO,12,0
      GPIO,5,0
      GPIO,4,1
endon

on Antenna6 do
      GPIO,12,1
      GPIO,5,0
      GPIO,4,1
endon

on Antenna7 do
      GPIO,12,0
      GPIO,5,1
      GPIO,4,1
endon

on Antenna8 do
      GPIO,12,1
      GPIO,5,1
      GPIO,4,1
endon
N00b to the world of ESPEasy, but I've been programming since the days of punch cards and paper tape :)

Post Reply

Who is online

Users browsing this forum: No registered users and 55 guests