Tasmota Plug - Auto Discovery - Sensor Vs Switch Or Light

https://tasmota.github.io/docs/Home-Assistant/#mqtt-discovery-removed

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 (8.1.0.2) 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 (8.1.0.2) Gosund plug but NOT my new Tasmots (12.2.0) Sonoff S31 Lite plug

Details:

  • I have about 15 plugs in total, mostly running the old Tasmota (8.1.0.2) 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:

image


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
image

image

Configuration.yaml

mqtt:
  light:
    - 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

core.entity_registry

,
      {
        "area_id": null,
        "capabilities": {
          "supported_color_modes": [
            "onoff"
          ]
        },
        "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 8.1.0.2

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.

https://github.com/arendst/Tasmota/releases/tag/v12.2.0

That link has further info here

https://tasmota.github.io/docs/Upgrading/#migration-path

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 8.1.0.2 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

Hi @DavidFW1960, I’m not compiling my own firmware. I did start at minimal 8.1.0.2 in one case and regular in another case, and after that I didn’t install any minimal, I followed the documented upgrade path (see below) - the instructions don’t indicate to use minimal), and now somehow I’m at 12.2.0 with minimal

if you use the .gz files you can skip minimal but theres not enough ram to flash the full version. If you have minimal now you should be able to flash the full version. How are you flashing them? Are you downloading the firmware and then using the GUI to update?

I’ve tried flashing from Tasmota OTA and via TasmoAdmin (using: Backlog OtaUrl http://ota.tasmota.com/tasmota/release/tasmota.bin.gz; Upgrade 1;)

I’d suggest downloading the firmware file to your computer and then upgrade by file upload in the console.

Bizarre! But I think I’m good.

  • I installed from the file like you said and got a message " Upload Failed Not enough space", but then it refreshed and it’s no longer minimal and seems to be working as expected
  • I then did the same for my other plug that was also at 12.2.0 minimal but instead of getting the error it said it was was successful and it works as well

The solution is really the following:

@DavidFW1960

@HasQT

@DavidFW1960

This was only necessary for the last stage of the update to 12.2.0

So much gratitude to you all for helping, including @gadgetbazza - who was also very helpful!

3 Likes

it’s an absolute bastard troubleshooting this crap at times…

It really is! I’m so thankful for the generosity of time and knowledge from people like you in this forum :heart:

1 Like