Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sonoff Touch: how to change the LED behaviour? #214

Closed
jdpiguet opened this issue Mar 16, 2017 · 30 comments
Closed

Sonoff Touch: how to change the LED behaviour? #214

jdpiguet opened this issue Mar 16, 2017 · 30 comments
Labels
enhancement Type - Enhancement that will be worked on

Comments

@jdpiguet
Copy link

jdpiguet commented Mar 16, 2017

Hi everybody,

On a Sonoff Touch, I would like to have the LED (or the sensor light) be in opposite of the relay:

  • If relay (MQTT "POWER") is on, LED is off.
  • If relay (MQTT "POWER") is off, LED is on.
    Does anybody knows how to do it?

Regards, Jacques-D.

@Rudoxxxx
Copy link

Problem is the sensor light?
If you send cmnd/sonoff/power on, then you LED relay is off?

@khcnz
Copy link

khcnz commented Mar 17, 2017

I think this could be done just be changing the template in sonoff/sonoff_template.h from
{ "Sonoff Touch",
GPIO_KEY1,
0, 0, 0, 0, 0,
0, 0, 0,
0, 0, 0,
GPIO_REL1,
GPIO_LED1_INV,
0, 0, 0, 0
},

To
{ "Sonoff Touch",
GPIO_KEY1,
0, 0, 0, 0, 0,
0, 0, 0,
0, 0, 0,
GPIO_REL1,
GPIO_LED1,
0, 0, 0, 0
},

This should invert the LED behaviour from how it normally works (note I haven't tested this).

@khcnz
Copy link

khcnz commented Mar 17, 2017

@arendst I know you don't have much space left - its a pity as otherwise we could have an "admin" or "advanced" mode that allows re-configuration of the non "user" programmable pins in the web ui / mqtt commands.

@davidelang
Copy link
Collaborator

davidelang commented Mar 17, 2017 via email

@khcnz
Copy link

khcnz commented Mar 17, 2017

I have only been around since v4.0, so I just a fresh chicken. You guys have probably been thinking about this for sometime.

Anyway a great platform - if you do have anything like this you could use some grunt work for I am happy to lend a hand, pretty sure I will be using the sonoff's everywhere in my home automation project so only right to give back since I am capable of.

@arendst arendst added the help needed Action - Asking for help from the community label Mar 17, 2017
@davidelang
Copy link
Collaborator

davidelang commented Mar 17, 2017 via email

@khcnz
Copy link

khcnz commented Mar 17, 2017

Yup I have sent him though a couple already - just don't want to double up on work he may already have mapped out in his mind!

@davidelang davidelang added the enhancement Type - Enhancement that will be worked on label Mar 19, 2017
@davidelang
Copy link
Collaborator

to be clear, the enhancement is to have an 'admin mode' that includes all the GPIO functions and all the GPIOs, not just the GPIO_USER ones

@khcnz
Copy link

khcnz commented Mar 19, 2017

@arendst how do you feel about such an admin mode? I could start it out just as an undocumented command - happy to send through a PR if its a direction you support?

@arendst
Copy link
Owner

arendst commented Mar 19, 2017

@khcnz I prefer an extension to ledstate command. I want to keep the fixed Gpio fixed. They can use the wemos module to play around.

@khcnz
Copy link

khcnz commented Mar 19, 2017

Good point - this could be achieved with LedState "Power State Inverted", I also wanted to add "On Always" as a selectable mode - as a way to indicate the unit is running / has power

@arendst
Copy link
Owner

arendst commented Mar 19, 2017

There is already an always on command for the led called ledpower on/off.

@khcnz
Copy link

khcnz commented Mar 19, 2017

Ahh you are right (of course!)

I had missed those somehow (I think my only justification is that LEDPOWER is not defined in the user_config). Would it make sense to combine those two options into ledstate? Already Ledstate 0 and ledpower 0 overlap?

@davidelang davidelang removed the help needed Action - Asking for help from the community label Mar 27, 2017
@khcnz khcnz mentioned this issue May 1, 2017
@arendst
Copy link
Owner

arendst commented May 4, 2017

Changed the code to turn led on if power is off for Sonoff Touch only in next release.

arendst added a commit that referenced this issue May 4, 2017
5.0.3 20170504
* Add command SensorRetain on|off to enable retaining of mqtt message
tele/sonoff/SENSOR (#74)
* Change WifiConfig timeout from 60 seconds to 180 seconds (#212)
* Change Sonoff Touch command Ledstate functionality by turning led on
if power is off (#214)
* Add 4 seconds delay after power on before enabling button to
workaround Wemos D1 mini RTS circuit (#380)
@kierenblack
Copy link

Is there any way of changing the led_inv1 to be on all the time or at least when it is connected to WIFI?

@Rudoxxxx
Copy link

Rudoxxxx commented Oct 26, 2017 via email

@jdpiguet
Copy link
Author

Running now with 5.9.1
I have changed the the sonoff_template.h file to match my requirement: the switch LED (the circle one) is now ON when the switch is off (the room is dark).
Lines 388-389:
GPIO_REL1_INV, // GPIO12 Red Led and Relay (0 = Off, 1 = On)
GPIO_LED1, // GPIO13 Blue Led (0 = On, 1 = Off)

@niklasfink
Copy link

Hey @arendst, I have a T1 (which is basically the same as the Touch?) and I'd like to have the same inverted LED functionality. You should probably add this device to that (77da1df#diff-9a0587e9aa7bed7ae2df63479960e7e0R2091) check as well.

I already installed my device, so is there a way to change that functionality remotely or rebuild the code locally and flash it remotely?

@niklasfink
Copy link

I figured the master branch has the change (https://github.com/arendst/Sonoff-Tasmota/blob/master/sonoff/sonoff.ino#L2210).
However, my behavior with a T1 is
Switch OFF = Background Light OFF
Switch ON = Background Light ON

How can I invert the behavior?

@Mathyass
Copy link

I dont understand if there is about only small blue LED or about Circles which are in touch places. I need to change behaviour of theese two beckgraound lights... is it possible ? Have T1 2CH EU.

@niklasfink
Copy link

@Mathyass that's right, I wasn't clear about which lights I'm talking about.
Indeed, I'm also talking about the touch button background lights and not the Wifi LED in the middle above the touch buttons.

I still didn't find a way to invert the behaviour of the touch button lights so that they are ON if they are off and OFF if they are on. That way you could find them better when it's dark.

@arendst
Copy link
Owner

arendst commented Apr 25, 2018

You can't simply because the led is hardwired to the relay.

@Mathyass
Copy link

Maybe add new smd LED and connect it somwhere but it wants someone who say where :-)

@tuga49
Copy link

tuga49 commented May 22, 2018

@arendst if I do that, I can get the the circle dots led on when switch is off? (the led I want on is the circle dots, not wifi circle):

Lines 388-389:
GPIO_REL1_INV, // GPIO12 Red Led and Relay (0 = Off, 1 = On)
GPIO_LED1, // GPIO13 Blue Led (0 = On, 1 = Off)

Model: Sonoff Touch

@jdpiguet you did it before, and it works? or no?

Thanks :)

@cirolaferrara
Copy link

And how to put LED always ON?

@Rudoxxxx
Copy link

Rudoxxxx commented May 28, 2018 via email

@tuga49
Copy link

tuga49 commented May 28, 2018

What I want to know is if I can get the circle dots led on when switch is off? (the led I want on is the circle dots, not wifi circle), when switch is off. @jdpiguet told if you edit the flashing code, it is possible. I just want to confirm. Because I seen somewhere that the led just can be on when relay is on....

@jdpiguet
Copy link
Author

As @arendst said: the LED is hardwired to the relay. In my case I'm using only the "switch", not the relay.
So I'm simply having the relay in the opposite position than the switch...
My setup is using an external main relay, controlled by MQTT.

@tuga49
Copy link

tuga49 commented May 28, 2018

Oh ok. So to make it work (circle dots led on while switch is off), i need to change the line and add an external relay? :( @jdpiguet

@ascillato2
Copy link
Collaborator

Hi,

This issue seems to be addressed. Closing. Please, reopen if necessary.

curzon01 pushed a commit to curzon01/Tasmota that referenced this issue Sep 6, 2018
5.0.3 20170504
* Add command SensorRetain on|off to enable retaining of mqtt message
tele/sonoff/SENSOR (arendst#74)
* Change WifiConfig timeout from 60 seconds to 180 seconds (arendst#212)
* Change Sonoff Touch command Ledstate functionality by turning led on
if power is off (arendst#214)
* Add 4 seconds delay after power on before enabling button to
workaround Wemos D1 mini RTS circuit (arendst#380)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Type - Enhancement that will be worked on
Projects
None yet
Development

No branches or pull requests