Configuration of Sonoff Mini w Tasmota, MQTT & Philips Hue

I have searched the forums and have not found an answer that can help me (this being the closest)

So to continue…

My plan was to use a dumb switch to control my Philips Hue lights via a Sonoff Mini flashed with Tasmota and MQTT, so that the bulbs would never be fully powered down & always available to the Hue app or Google Assistant.

I have flashed my Sonoff Mini with Tasmota, set GPIO 04 to Switch 1, wired it all up and have a switch card showing in Home Assistant.

Currently, the Dumb Switch and Home Assistant Switch both work as expected, I can turn the bulb on and off. However, the issue is that when the Hue bulb is off it is not available in the Philips Hue App or Google Assistant.

What I would like help with is:
How can I get the switch toggles to turn the Hue bulb off via Home Assistant & the Hue integration?

I am guessing I need to change the GPIO 04 action and then set something up in HA, but I don’t really know how to do this. Can someone please help?


I have solved it!

Open the Tasmota Console on the flashed Sonoff Mini.

Enter to set the relay to the on state:

PowerOnState 1

Enter to retain the power state:

PowerRetain 1

Enter to turn the conventional wall switch into a toggle switch (when the switch it toggled the following mqtt command is published: cmnd/my-custom-topic/SWITCH 2):

Rule1 on switch1#state do publish cmnd/my-custom-topic/SWITCH %value% endon

and to activate the rule

Rule1 1

Add the the config to your configuration.yaml

  - platform: mqtt
    name: "Kitchen light"
    state_topic: "stat/my-custom-topic/SWITCH"
    command_topic: "cmnd/my-custom-topic/SWITCH"
    availability_topic: "tele/my-custom-topic/LWT"
    qos: 1

Test the topic & payload in Home Assistant by tapping Developer Tools, then the MQTT tab and entering
cmnd/my-custom-topic/SWITCH into the Topic to subscribe to field.
Toggle the light switch and you should see the MQTT output.

The final step is to create the Automation.

  1. Name the Action.
    a. Enter a description
  2. Set Trigger:
    a. Trigger type: MQTT
    b. Set topic: cmnd/my-custom-topic/SWITCH
  3. No condition is required
  4. Set Actions:
    a. Action type: Device
    b. Device: Kitchen Light (or your light)
    c. Action: Toggle Kitchen light (toggle you light)
  5. Save & Test