Howto add multiple sonoff touch switches flashed with Tasmota?

Hi, I just flashed a Sonoff Touch switch with Tasmota firmware (IP: 192.168.1.80 and client name is sonoff-corr) , and configured it in Home Assistant succesfully…

in configuration.yaml added…

mqtt:
  - broker: 192.168.1.2
    port: 1883
    client_id: sonoff-corr
    username: vpomax
    password: 12345

switch:
  - platform: mqtt
    name: "Sonoff Corr"
    state_topic: "stat/sonoff/POWER"
    command_topic: "cmnd/sonoff/power"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    retain: true

But now I flashed a second Sonoff Touch switch (IP 192.168.1.81 and client name is sonoff-ing)… howto add it to Home Assistant?

2 Likes

On your second tasmota sonoff, under MQTT settings change the topic to something other than what the first sonoffs topic is ( for example, “sonoffNEW” ) , unless of course you want everything to switch on and off at the same time.

Then add some yaml

switch:
  - platform: mqtt
    name: "Sonoff Corr"
    state_topic: "stat/sonoff/POWER"
    command_topic: "cmnd/sonoff/power"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    retain: true

  - platform: mqtt
    name: "Sonoff New"
    state_topic: "stat/sonoffNEW/POWER"
    command_topic: "cmnd/sonoffNEW/power"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    retain: true

The client name is only used by the MQTT server. It only needs to be unique.

2 Likes

Yep, no need to change client ID from what it defaults to as it creates a unique name automatically.

Many thanks… problem solved :slight_smile:

No matter what I do or what order when I add the second switch in configuration.yaml the first switch does not show up on the Home Assistant
image
image

Both Sonoffs work perfectly but I cannot get more than ONE to show up in Hassio at the same time and I have a shit load more I want to flash but I cannot show more than ONE at a time. This is really a PITA.
image
image

The second switch always removes the first switch

I got it… i had to add those little minus signs and it worked
image
image

3 Likes

Well done :+1:

The dashes are fundamental to adding multiples of anything within yaml.

2 Likes

saved my time :slight_smile:


my configuration looks like this, but i still do not have the second switch on my home page.
and it is already connected to mqtt server (both of them).