Sonoff Basic + Tasmota onboard LED function

Hi

Default function of the onboard LED when not blinking for errors or connecting to WiFi etc is:

Relay on = LED on
Relay off = LED off

The led actually shines through my wall switch making it glow nicely.

I’d like to change the led function to either:

  1. If relay is off then led light is on. This will allow me to find the light switch in the dark when the lights are off.

Or

  1. Control the led via home assistant. This will allow me to do the above or the other option would be to have the led off during the day and on at night when it’s dark.

Doors anyone know of you can change the led function. I didn’t find anything useful in the console wiki for tasmota.

Thanks
Kiwi

Erm… if you’d read it you couldn’t really have missed these :slight_smile:

LedPower Show current led power state as On or Off
LedPower 0 / off Turn led AND LedState Off
LedPower 1 / on Turn led On AND LedState Off
LedState Show current led state as 0 to 7
LedState 0 / off Disable use of LED as much as possible
LedState 1 / on Show power state on led (inverted for Sonoff Touch)
LedState 2 Show MQTT subscriptions as a led blink
LedState 3 Show power state and MQTT subscriptions as a led blink
LedState 4 Show MQTT publications as a led blink
LedState 5 Show power state and MQTT publications as a led blink
LedState 6 Show all MQTT messages as a led blink
LedState 7 Show power state and MQTT messages as a led blink

I use LEDState 2 so they just flash once when triggered.

2 Likes

Pardon me if I’m misunderstanding, but I don’t see how that resolves the question? LedState 2 appears to flash the LED when the MQTT message is received. The request is to have the LED be turned on whenever the relay is turned off, or to control the LED via HomeAssistant… unless I misunderstand how this is implemented, the only way LedState 2 would accomplish this would be if you send constant messages to the MQTT topic that the sonoff is subscribed to in order to make the LED flash constantly while it was dark.

It didn’t :slight_smile:

Well, I wanted to have the LED “reversed” as well, and I was able to figure out a way to do so, it wasn’t quite as simple as just having an LedState option, but it is easy enough to do using just the web interface.

  1. Go to “Configuration” menu
  2. Go to “Configure Module” screen
  3. Change “Module type” dropdown and change it from “01 Sonoff Basic” to “18 Generic” (it should be at the very bottom of the list)
  4. Click “Save” and it will restart with the new module type
  5. Go back to the “Configuration” > “Configure Module” screen
  6. Set the following values (any that aren’t listed should be left as “00 None”):
  • “GPIO0” to “17 Button1”
  • “GPIO1” to “71 SerBr Tx”
  • “GPIO3” to “72 SerBr Rx”
  • "GPIO12: to “21 Relay1”
  • “GPIO13” to “52 Led1”
  • “GPIO14” to “09 Switch1”
  1. Click “Save” to save values and restart module
  2. The unit should now work as it normally does, except the LED status should now be reversed from the power relay status.

Basically what we just did was set it as a “Generic” Sonoff instead of the “Sonoff Basic”, and then set all the “standard” values for the Sonoff Basic, except “GPIO13” is now set as “52 Led1” instead of “56 Led1i”. Led1i is “LED Inverted”, so Led1 is the opposite of that, which means the LED is off when the power relay is on, and the LED is on when the power relay is off.

3 Likes

I just pointed the OP to the part of the wiki he said couldn’t find which lists LED related commands exactly as he requested above. He never acknowledged that so we couldn’t continue the conversation and work towards an answer for his situation.

Happens all the time on here, people ask questions, someone goes to the trouble of trying to help and the poster either never comes back or, as the OP has now shown, just too rude to respond.

For my own curiosity, I just had a quick look myself and the complete solution is actually in that list of commands, this is the important one…

LedState 1 / on Show power state on led (inverted for Sonoff Touch)

So, simply change the device to be a Sonoff Touch, set LedState to 1, job done!

Hah, right you are, that does the trick. I had seen the note about it being inverted for the Sonoff Touch, but for some reason I took that to mean the touch hardware was inverted, not that the configured behavior for the LED was reversed. Well, that’s much simpler to configure than my approach :slight_smile:

2 Likes

You’re welcome, was impressed with your creativity all the same :+1:

Yes but when i try this with my sonoff basic, it removes gpio14 that i use for my wall switch

This video shows how to control the led separately via home assistant

1 Like

I don’t use node red so I’ll have to figure out the equivelent

Maybe adding cmnd/sonoff/ledpower and payload to the switch config in HA. Along with the power commands?

I was able to invert the status of the LED light from the console using this:

LedPower 2

Found command here:

Hi, is this still working with Tasmota 7.1.1? I just tried it and doesn’t seem to be working: on LedState 1 the top LED ( one showing if wifi is connected ) stays ON as soon as wifi is locked in, but the witness LED is OFF.
LE: I forgot to mention: testing on a Sonoff T1 EU

1 Like

@xyboox
Hi same problem as you with model EU.

did you find the solution?