Sonoff tx touch switch MQTT toggle ONLY

Hey, can anyone help solve my issue that I’m having. I have wired in my sonoff tx touch to my living room lights which have hue bulbs in them!
The switch works great using the relay, but when I switch the lights off using the switch it kills the power completely so they become unresponsive in HA and HomeKit! What settings do I need to use in Tasmota to keep the relay always on, and what config do I need to make for the touch button just to toggle the lights on and off using MQTT commands! Thanks

I can point you to your last post about the exact same problem with @tom_l answered for you…

Ok Andy so am I correct in saying if I set the ButtonTopic to 1 that chances it to MQTT command. But how do I tell them switch to talk to my smart lights? Is that in Tasmota or HA? Thanks

That is HA

Thanks so do I have to do an automation for this or is it a template for MQTT?

You need an automation for this.

Trigger -> mqtt received
Action : hue bulbs toggle

That is brilliant thanks… so when I change my ButtonTopic to 1 will that automatically send the information to HA… when doing the automation what service do I use for the trigger MQTT_publish? Thanks again

You need something like this :

- id: '1567852308062'
  alias: Ikea switch1
  trigger:
  - payload: 'ON'
    platform: mqtt
    topic: sensor/ikea_switch1_sensor
  condition: []
  action:
  - data:
      entity_id: light.ikealight
    service: light.toggle

Replace the topic with received topic, and the payload with the received payload.

That is great thanks… I know I’m asking how to suck eggs lol, but I’m new to the whole MQTT. Where do I find the results for the topic received and payload received?

Developer tools -> mqtt. Listen to # , press your button and you will see it pass.

When I am listening for the information I get my topic as Living_Room_Light_Switch/stat/Power
Living_Room_Light_Switch/stat/Result
Does that sound right?
Also I can’t see any payload topic? What am I actually looking for? Thanks

topic is Living_Room_Light_Switch/stat/Power
payload is ‘ON’ or ‘OFF’

image

That’s brilliant I think I’m on the right tracks… :grimacing::grin:
I just want to confirm the steps I take in Tasmota to tell the switch to stop using the relay and always be on? Do you know the commands for the console?
Thanks

so im getting a little further now lol, if i set my switch in the console to ButtonTopic LRswitch, it doesn’t use the rely at all… the touch button doesnt work… its getting a message to HA
Message 51 received on LRSwitch/stat/BUTTON1 at 7:21 PM:
{
“STATE”: “TOGGLE”
}

so do i need to add a automation now so when the touch button is pressed it toggles on my hue bulbs? am i on the correct lines ? thanks

I have Sonoff’s wired exactly like this BUT all I do is DON’T connect the L1 light wire to the Sonoff, I just bridge it to the live wire so there is permanent power at the bulb. This way, I can still hear the relay click when I touch the button (although the relay is not doing anything). There is a slight delay before the hue comes on as the automation has to run and I like to hear the click so I know I’ve pushed the button.

You would need an automation, something like the below (change the hue bulb names).

- id: '1567852308062'
  alias: Sonoff switch1
  trigger:
  - payload: 'TOGGLE'
    platform: mqtt
    topic: LRSwitch/stat/BUTTON1
  condition: []
  action:
  - data:
      entity_id: light.name_of_hue
    service: light.toggle

Simon

Wow thankyou for that answer… I didn’t know you could do that… what option did you choose in Tasmota to turn it into a toggle… because when I do ButtonTopic valve it disables the relay… and just sends the commands to HA