Sonoff Wifi 5-pin LED control

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
User avatar
Westcott
Normal user
Posts: 24
Joined: 05 Sep 2016, 18:14
Location: Gloucester
Contact:

Sonoff Wifi 5-pin LED control

#1 Post by Westcott » 25 Dec 2016, 18:36

Hi,
I've gor my Sonoff flashed (147) and under 2-way control with Domoticz and some Rules.
The relay switches, and the LED goes on and off as required.
However, the LED, even when off, switches back on whenever the Sonoff sends any data back to Domoticz, e.g. RSSI.
If the LED is already on, it blinks!
Is this something hardwired into the device?
Domoticz, Sonoff, ESP32

data
Normal user
Posts: 93
Joined: 10 Dec 2016, 11:26

Re: Sonoff Wifi 5-pin LED control

#2 Post by data » 25 Dec 2016, 18:45

Post your rules!

User avatar
Westcott
Normal user
Posts: 24
Joined: 05 Sep 2016, 18:14
Location: Gloucester
Contact:

Re: Sonoff Wifi 5-pin LED control

#3 Post by Westcott » 25 Dec 2016, 20:41

Rules as requested.
SW0 = Push switch GPIO-0
Relay, State = GPIO-12 and its Value

Code: Select all

on TurnOn do
  if [Relay#State]=0
    gpio,13,0
    gpio,12,1
    inputswitchstate 0,1
  endif
endon

on TurnOff do
  if [Relay#State]=1
    gpio,13,1
    gpio,12,0
    inputswitchstate 0,0
  endif
endon

on Toggle do
    event,ToggleRelay
endon

on SW0#Switch=1 do
    event,ToggleRelay
endon

on ToggleRelay do
  if [Relay#State]=1
     gpio,13,1
     gpio,12,0
     inputswitchstate 0,0
 else
    gpio,13,0
    gpio,12,1
    inputswitchstate 0,1
  endif
endon

On System#Boot do    //When the ESP boots, do
  timerSet,1,10      //Set Timer 1 for the next event in 10 seconds
endon

On Rules#Timer=1 do  //When Timer1 expires, do
  SendToHTTP RaspberryPi,8080,/json.htm?type=command=switchlight&idx=2313&switchcmd=Off
    Pulse,13,0,500
    gpio,12,0
endon
Domoticz, Sonoff, ESP32

data
Normal user
Posts: 93
Joined: 10 Dec 2016, 11:26

Re: Sonoff Wifi 5-pin LED control

#4 Post by data » 02 Jan 2017, 18:55

Remove all lines with 'inputswitchstate x,y', try again and post your results please.

User avatar
Westcott
Normal user
Posts: 24
Joined: 05 Sep 2016, 18:14
Location: Gloucester
Contact:

Re: Sonoff Wifi 5-pin LED control

#5 Post by Westcott » 02 Jan 2017, 21:31

Hi Data,

Thanks, but I'm sure that the LED is also controlled by the main ESP code, overriding my settings.
I have had a look in the code.
The function void statusLED(boolean traffic) in Misc.ino is called from several places.
It certainly appears to make the blink I noticed when device data is sent to Domoticz and the LED is already on.
Also, if Wifi is connected, the LED state is set LOW which I guess is ON.
Domoticz, Sonoff, ESP32

data
Normal user
Posts: 93
Joined: 10 Dec 2016, 11:26

Re: Sonoff Wifi 5-pin LED control

#6 Post by data » 04 Jan 2017, 19:24

Have you made any changes on the GPIO page?

I have the same setup as you do but have not this issue.

User avatar
Westcott
Normal user
Posts: 24
Joined: 05 Sep 2016, 18:14
Location: Gloucester
Contact:

Re: Sonoff Wifi 5-pin LED control

#7 Post by Westcott » 04 Jan 2017, 19:43

Hi Data,

Thanks for pointing me in the right direction!
In Hardware, I had set Wifi Status Led: to 13.
Setting it blank fixes it.
Domoticz, Sonoff, ESP32

Emmi
New user
Posts: 1
Joined: 05 Mar 2017, 15:19

Re: Sonoff Wifi 5-pin LED control

#8 Post by Emmi » 05 Mar 2017, 15:59

Hello i am new in sonoff esp things anf might have killed my firt one

It would de helpfull to see what you have exactly done in all menues of the espy easy pages when flashing the sonoff to R120/147

I think and hope most people will have this first

pressing the button and switching the relais with status LED

sincerly
Michael

Post Reply

Who is online

Users browsing this forum: No registered users and 84 guests