Tasmota Plug - Auto Discovery - Sensor Vs Switch Or Light

Hi all,


  • How do I get auto discovery of my tasmota plugs to become discovered/available in HA as an entity with a slider to turn on/off power to the plug (such as a switch or plug entity) instead of it showing up as a sensor and binary_sensor entity as is what’s happening for me (which has no slider to turn on/off)


  • HA became corrupt when I tried to do something and after trying to resolve it for a while I decided to just get the latest Hyper-V (.vhdx) and start over, then unfortunately restoring my backup didn’t work so I lost everything - just context here not really looking for input on this at this point

  • My prior HA setup had all my tasmota updated Gosund WP6 Plugs setup with sliders to turn the power to them on/off (I think HA saw them as either switch or light), but when I execute the command: SetOption19 1 from tasmota console so HA successfully auto discovers them, they show up as both sensor and binary_sensor entities (see below image), neither of which provides a slider to turn the power on/off as I want.

  • Unfortunately I’m not sure how my old HA setup had all the switches with sliders for these plugs to turn them on/off but I was hoping to automate it as part of auto discovery

  • My Gosund WP6 Plugs are configured as follows (per the instructions in that link) where GPIO3 is “Button (17)” (see below image) which I’m guessing is where the “button1” comes from in HA (see below image) which doesn’t provide a slider to turn the power to the plug on/off as I want and used to be the case with my old HA setup

Thanks for any help you all might be able to provide :slight_smile:

Which firmware version? You should not use set option 19 anymore - should use the tasmota integration instead

Thanks @DavidFW1960 for your reply :slight_smile:,

  • Tasmota by Theo Arends - old I know but my general rule of thumb with this stuff is the if it ain’t broke… theme. But maybe my old version is impacting my ability to achieve my goal. I can try updating it, but would doing so achieve my goal, if not, is there anything else I need to do? See my next point regarding “tasmota integration”

  • Would you mind elaborating on what you mean by “…should use the tasmota integration instead”? I’m familiar with Integrations in HA (Settings->Devices & Services->Integrations) but I didn’t think that’s what you meant so I found this Tasmota Integration reference but it says the following which is what I’m doing and what you’re saying I shouldn’t do :slight_smile: : “Once you configure the Home Assistant integration every new Tasmota device with SetOption19 0 set will be discovered automatically.”

Again, thanks so much for your time and effort, it’s much appreciated :slight_smile:

@DavidFW1960, btw, I tried but failed to update one of my Gosund WP6 Plugs plugs receiving the following errors:

Over the air failed with tasmota-lite.bin.gz (I see this in the console):

Direct file upgrade with tasmota-lite.bin.gz (that I downloaded):

Files tried:

  • tasmota.bin
  • tasmota.bin.gz
  • tasmota-lite.bin.gz

Per Per open issue #437 “Updating procedure seems not working” I tried the following (followed by upgrade 1) using TasmoAdmin but consistently got: {“Upgrade”:“Failed Verify Bin Header Failed”}

I was able to install 8.1.0 Doris version of tasmota-minimal.bin but from there I continued to get the error {“Upgrade”:“Failed Verify Bin Header Failed”} trying to update to tasmota.bin.gz for the following versions, though my understanding per @HasQT is that I’ll need somewhere around 12.1.1 to be able to leverage Tasmota Integration:

Probably much help to your original query. But I have recently purchased some LocalBytes plugs, pre flashed with Tasmota (v12.1.0) and then joined them up to my MQTT service and then added the Tasmota integration to HA and they have all integrated automatically without a hitch, which is fantastic,.

I do have a question though, I am using two of these smart plugs to control Xmas lights and would like them to appear as “lights” within HA, is it possible to change this somehow?


Actually, just found the answer for myself! setoption30 1 makes the plug announce itself as a light (rather than default of setoption30 0).

Must remember to search for solutions outside of community.home-assistant.io once in a while! :slight_smile:

Thanks @gadgetbazza , unfortunately that isn’t the solution, at least for me

I believe the setoption30 1 is not working for me because my plugs are showing as sensor and binary_sensor (vs a switch)

Per Tasmota Integrations (also repeated here)

  • Tasmota Relays will be added as Home Assistant switch entities, if SetOption30 0. If SetOption30 1, relays will be added as light entities.
  • Tasmota Sensors will be added as Home Assistant sensor entities."

Also see the below from Tasmota SetOption Commands, though it doesn’t give as much detail releated to switch/light/sensor:

"SetOption30 Enforce Home Assistant auto-discovery as light

  • 0 = relays are announced as a switch and PWM as a light (default)
  • 1 = both relays and PWM are announced as light"

As far as I can tell, HA should treat my plug (configured as a button as shown in my OP) with the following functionality as described in Buttons and Switches

  • " By default a button toggles the corresponding power state. Every time the button gets pressed a relay or light changes its Power state (ON or OFF)."

Interesting thing is that TasmoAdmin shows my plugs with a toggle!

Again, somehow my old installation of HA (before it became corrupt) made the entities available in such a way that I could toggle them which makes it seem that this is possible, I just haven’t been able to figure it out yet…

@DavidFW1960, also notable is that I picked up a few Sonoff 31 Lite plugs and flashed them with tasmota ver 12.2.0 (also configured as a Button (see: Sonoff S31 Lite)) and they didn’t AutoDiscover - they can’t be found in MQTT entities (nor searching for them under entities). Interesting though, SetOption19 1 didn’t allow them to be AutoDiscovered under MQTT (unlike my older Gosund WP6 Plugs which showed up pretty much immediately under MQTT. At this point, my new Sonoff S31 Lite plugs aren’t even available in HA (so that would be a new/independent additional issue f/ my OP)


HA mqtt discovery was removed in 12.1.1 or there abouts from Tasmota.

There’s a section in the document you linked that mentions switches can be shown as sensors based upon option 114 setting. Could it be this?

Regarding the Sonoff plugs that you can’t auto discover. You mention that they can’t be found in MQTT, are you checking using something like MQTT Explorer? If the data is not getting to the MQTT broker, then that would be the first step to resolve before determining why HA doesn’t auto detect it. Sorry if that’s teaching you to suck eggs on that part.

I was trying to see if there is a way to list the options that are currently set on the Tasmota device, but the documentation only seems to have a setoption command, do you know if there is a show option equivalent?

Hi @HasQT , thanks for the response, that would explain why SetOption19 1 had no impact with my Tasmota (12.2.0) on my new Sonoff S31 Lite plug.

Hi @gadgetbazza, thanks again for responding to answer your questions

  • SetOption114 is’t supported in the old Tasmota ( for my old Gosund plugs, I receive the response: {“Command”:“Error”}, though it does work in my new Tasmota (12.2.0) for my new Sonoff S31 Lite plug, I receive the response: {“SetOption114”:“OFF”}
  • I also couldn’t find a way to find a list of available options for any particular Tasmota device/version
  • Auto Discovery is now working automatically without SetOption19 1 (per instructions in MQTT Discovery)) for my old Tasmota ( Gosund plug but NOT my new Tasmots (12.2.0) Sonoff S31 Lite plug


  • I have about 15 plugs in total, mostly running the old Tasmota ( Gosund plugs (see above notes in my struggles updating them) and a few new Tasmota (12.2.0) Sonoff S31 Lite plugs
  • My MQTT Settings in Tasmota follow the example in MQTT Discovery where I use the default homeassistant prefix followed by the “type” of plug (I’ve tried both switch and light) but it only seems to dictate the path in the MQTT database (per MQTT Explorer) as shown in the below image
  • Both plugs are setup as follows where I can successfully capture turning on/off my plug switches in both HA’s MQTT Settings and in MQTT Explorer:


Where does that leave me?

  1. I need help with HA MQTT Discovery (which now no longer requires me to use SetOption19 1 for the old Gosund WP6 Plugs to be discovered), so that it will produces entities with a slider to turn on/off power to the plug (currently it only produces sensor and binary_sensor entities where I have no switch option for it (despite how it shows with a switch in TasmoAdmin (see my prior message & image for a visual))
  2. I need help with HA MQTT Discovery discovering / producing a device and entitie(s) for my Sonoff S31 Lite plug

In lieu of 1. (above ^^^), I could alternatively use help for someone to provide instructions to make either of the sensor and binary_sensor entities that MQTT Discovery produce a slider to turn on/off power to the plug (remember this used to work with my old HA installation before it crashed - for what it’s worth, I may have been able to hack it my old HA installation updating the core.entity_registry, I know I played around with the .storage files a LONG time ago, I just don’t remember the details.

So for my integration I went with the Tasmota integration for HA whereas it looks like you are relying purely on MQTT integration and discovery. Is there a reason for this that I don’t follow?

For reference here’s a screenshot of my MQTT options in my Tasmota plugs (v12.1.1) and they are automatically shown under the Tasmota integration in HA.

My Tasmota config in HA I think is just out of the box with auto discovery working.

Here’s my Tasmota Integration for HA. I have my topic start with homeassistant (as that’s the default path in the MQTT discovery prefix as shown in my last post) and the sensor and binary_sensors showed up automatically via Auto Discovery (also see below)

Out of desperation, I hacked in the light.livingroom_lamp by updating configuration.yaml & core.entity_registry. It almost works, clicking on the “on” and “off” buttons sets POWER = ON (or OFF), just like the tasmota GUI does, but it doesn’t end up in a RESULT = {“POWER”:“ON”} (or OFF), i.e. there is a disconnect somewhere to a message isn’t being sent. Note that the D0524A_LI_1 matches up with the unique_id in the core.entity_registry. The device_id keeps getting reset to null which is probably what it doesn’t work as expected



    - name: LivingRoom-Lamp
      state_topic: "homeassistant/light/LivingRoom-Lamp/cmnd/power"
      command_topic: "homeassistant/light/LivingRoom-Lamp/stat/POWER"
      qos: 1
      payload_on: "ON"
      payload_off: "OFF"
      unique_id: D0524A_LI_1


        "area_id": null,
        "capabilities": {
          "supported_color_modes": [
        "config_entry_id": "18778b7569c8467eddd1e8bb55f9a05f",
        "device_class": null,
        "device_id": null,
        "disabled_by": null,
        "entity_category": null,
        "entity_id": "light.livingroom_lamp",
        "hidden_by": null,
        "icon": null,
        "id": "c9bc9645d629f601fb57b02a6d5782eb",
        "has_entity_name": false,
        "name": null,
        "options": {},
        "original_device_class": null,
        "original_icon": null,
        "original_name": "LivingRoom-Lamp",
        "platform": "mqtt",
        "supported_features": 0,
        "unique_id": "D0524A_LI_1",
        "unit_of_measurement": null

I have a few items posting to MQTT HomeAssistant topic but none of them are lights so so don’t have anything to compare.

But going back to my other point, have you not considered adding the Tasmota integration to HA rather than trying to match the HA MQTT topics? Might be an easy win in terms of matching up the sensor / light / switch types?

Ugh, I was a bit confused by Tasmota Integration, In misread it and though it said to SetOption19 1 so I dismissed it. Once In installed it and restarted my new Tasmota 12.2.0 devices, they showed up!

As @DavidFW1960 originally mentioned using that along with the latest Tasmota will do the trick. My problem now is installing the latest Tasmota on about 10+ of my Gosund WP6 Plugs as I documented here (which as I’ve shown I’m not having a lot of luck with), or if someone can help me with the hack I’ve been working on (see above) to make a light available with my Gosund WP6 Plugs using Tasmota

The Tasmota Console the full topic is reversed. When you set option 19 it screws it up and when you disable that it doesn’t correct it. Also the firmware you use can’t be the lite version…

You have to follow the migration path I believe.

8.1 to 8.5.1 to 9.1 then to the latest.


That link has further info here


Around 9.2 is when the integration comes into play if I recall…

Thanks @HasQT, I used the upgrade path you posted but I guess because I started with the minimal, eventhough I used the exact links mentioned in the upgrade path and am now on 12.2.0, it still shows as “MINIMAL firmware please upgrade”

Ugh! The same thing happened when I upgraded my other plug that started at then followed the upgrade path but ended up somehow with the “MINIMAL firmware please upgrade” on that one too. I think it I noticed all the way up to 9.1.0 was NOT minimal, not sure how the v12.2.0 somehow became minimal?

Unless you are compiling your own firmware you always need to use minimal first. That 12.2.0 one you should be able to flash the full firmware now