Home assistant tasmota discovery switches

Is it possible to discover the tasmota switches.

I tried integration but only shows the lights/relay. How about switches?

Morevorer is it possible to detect HOLD actions?


I did that, however I do not get the switches. Only the outputs (relays)

For HOLD you will need to use rules.

This is an example I use :

Backlog ButtonTopic 0; SetOption1 1; SetOption11 0; SetOption32 20 

Rule1 on button2#state=3 do publish cmnd/ALLLIGHTS/power 2 endon  on button2#state=2 do publish SENSOR/ALLLIGHTS ON endon  

Rule1 1

Double-click switches the relay, Single-click sends ’ SENSOR/ALLLIGHTS ON’ to MQTT, Hold sends ‘cmnd/ALLLIGHTS/power 2’ to MQTT

See the Tasmota wiki for more information

Makes sense thank you.

But in a more simplistic approach it would be nice to find the switch state in home assistant.

Why does automatic discovery does not create an entity with the switch state?

Found the problem.

I needed to set SwitchTopic and ButtonTopic to 0

Hi all, bumping this topic I’ve recently begun modding Sonoff devices, adding several switches to a Mini R2 unit. After reading here and on the Tasmota site, I’ll have to admit I’m somewhat up the creek, having a hard time wrapping my head around sensor discovery: No matter what I do, I can’t seem to get HA to discover the additional switches I’ve added.

The use case is to have a 4 binary inputs (2 reed relays, 2 PIR’s), showing up in HA as binary sensors
This is what my active Tasmota template looks like:

(running latest Tasmota at time of writing 12.1.1)

I have issued the following console commands:
switchmodeN 2 ( switch N=1…4 so switch states follow actual state of the GPIO inputs: ON=closed switch)

Looking at the MQTT explorer, I can see the switch states being updated, however that does me no good when the switches aren’t being discovered in the first place.

So reading up on things, it appears there are several things that need to be configured and this is kinda where the wheels come off the cart here. I am really trying to understand how all this works:

  • How would one configure tasmota to report multiple switches and have HA discover treat them as binary sensors?
  • I am not sure if I am using the right switchmode as mode 15 seems to do what I want, but it doesn’t yield different results?
  • setting up the rules in the examples, how does this help HA to create binary_sensor.nnn entities?
  • Is there any means to having tasmota display current switch status on the main screen, like a DS18B20 temperature sensor? (not critical, but useful)
  • Is it a jumble of HA custom configureation.yaml entries, tasmota rules and whatnot setoptions to make it work? If so, what would that look like for this use case?

I’m trying to determine the right combo of switchmode, rules, switchtopic, setoptionNN etc, but so far have not seen much success. If somebody can provide a useful push in the right direction to get HA sensors working, it would be hugely appreciated. Thanks!!

Update: I’ve read several posts, blogs which says to turn on SetOption19, however if I do that, the entire device disappears from HA’s Tasmota integration, but it does not show up under MQTT?

Since the MyQ debacle, I am also trying to get this to work on a couple old garage doors.
I have found several ways that I don’t understand and can’t make work anyway and I would like to understand what makes it work for future use and not just copy and paste. Thanks in advance.