Tasmota MQTT (LSC)

I am in the process of migrating my current IoT setup to Home Assistant.

I have some LSC bulbs that I flashed to Tasmota so that I could control them via WiFi using simple commands (from a webpage with buttons and sliders) to dim them and change their color.

From what I understand, I should be able to connect these bulbs to Home Assistant using MQTT.
I found the following: Home Assistant Tasmota Integration

This integration allows you to control Tasmota devices over MQTT.
Requirements:

  • MQTT broker and the MQTT integration set up in Home Assistant.

Does this mean I need to install an MQTT server or something similar?

Yes Dirk,

If you are running HAOS is is a simple add-on install. If you run container version then add a docker to run MQTT.

Thx, I don’t run docker.

I have installed mosquitto
apt install mosquitto mosquitto-clients
systemctl enable mosquitto
systemctl start mosquitto

and configured
vi /etc/mosquitto/mosquitto.conf
listener 1883
protocol mqtt

Now I see

Message 2 received on tele/tasmota_lamp1/STATE at 10:36 PM:
{"Time":"2025-02-16T22:36:55","Uptime":"0T00:10:13","UptimeSec":613,"Heap":26,"SleepMode":"Dynamic","Sleep":10,"LoadAvg":99,"MqttCount":4,"POWER":"ON","Dimmer":71,"Color":"7A3B","HSBColor":"0,0,0","Channel":[48,23],"CT":266,"Fade":"ON","Speed":2,"LedTable":"ON"}

Send from console of the bulb: SetOption73

Message 3 received on tele/tasmota_lamp1/STATE at 10:41 PM: 
{"Time":"2025-02-16T22:41:55","Uptime":"0T00:15:13","UptimeSec":913,"Heap":26,"SleepMode":"Dynamic","Sleep":10,"LoadAvg":99,"MqttCount":4,"POWER":"ON","Dimmer":71,"Color":"7A3B","HSBColor":"0,0,0","Channel":[48,23],"CT":266,"Fade":"ON","Speed":2,"LedTable":"ON"}
Message 2 received on tasmota_lamp1/LOGGING at 11:11 PM:
23:11:38 WIF: Connected
QoS: 0 - Retain: false

Add Tasmota as intergration, do I miss something?

Put your mqtt credentials into Tasmota.

I don’t used that (till it work)

vi /etc/mosquitto/mosquitto.conf
allow_anonymous true

Are you running Supervised or Core install?

Core in Ubuntu

I have setup credentails (for the test)

mosquitto_passwd -c /etc/mosquitto/pwfile tasmota

and in the mosquitto.conf:

allow_anonymous false
password_file /etc/mosquitto/pwfile
listener 1883
protocol mqtt

After that MQTT in the intergrations (HA) gives an " Re-authentication required with the MQTT…"
After completing the credentials, the warning was gone.
This can be confirmed that the communication between Mosquitto and The Mqtt van HA has found each other

If I send this on the commandline of HA I can turn the bulb on and of

mosquitto_pub -h <IP-ADDRESS>* -t cmnd/tasmota_lamp1/POWER -m "off" -u tasmota -P <PASSWORD>

  • strange that it not will work with local IP like 127.0.0.1 but only the network-IP

I think it’s working

with the command SetOption19 1 * the Tasmota send the config to the MQTT broker :slight_smile:

And this is automatically adjusted inTasmota %preflex%/%topic%/ to %topic%/%prefix%/

Are your devices using an old version of Tasmota? Or a recent custom version that you compiled?

The reason why I ask is because the default value of option 19 is 0 for an important reason. The preferred MQTT discovery protocol is the one developed by Tasmota, not Home Assistant’s MQTT Discovery.

Tasmota’s developers created their own method of MQTT Discovery (several versions ago) and that’s the code included in their compiled releases of firmware. They no longer support Home Assistant’s MQTT Discovery protocol.

Home Assistant supports Tasmota’s method of MQTT Discovery via the Tasmota integration.

Configuring Tasmota to work with Home Assistant is explained in Tasmota’s documentation where it indicates that option 19 is set to 0

Thanks.

I think it’s an old version
"sw_version":"8.1.0(tasmota)","manufacturer":"Tasmota"

Is that the reason that I have to put option Setoption19 to 1?
And that the returned status to HA are not processed?

I can operate the lamp, but Ha does not process the data that sends the tasmota back to Ha.

Can I still adjust this myself, or add the lamp manually?

I can update from 8.1.0 Doris to 8.5.1 Hannah
Or max 9.1.0 Imogen ( Tasmota devices flashed with version 9.2, or later does not support this integration.)

17:35:20 MQT: homeassistant/sensor/6D0E95_status/config = {"name":"Tasmota_keuken_11 status","stat_t":"~HASS_STATE","avty_t":"~LWT","frc_upd":true,"pl_avail":"Online","pl_not_avail":"Offline","json_attributes_topic":"~HASS_STATE","unit_of_meas":" ","val_tpl":"{{value_json['RSSI']}}","ic":"mdi:information-outline","uniq_id":"6D0E95_status","device":{"identifiers":["6D0E95"],"connections":[["mac","XX:XX:XX:XX:XX:XX"]],"name":"Tasmota_keuken_11","model":"LSC-Filam-Big","sw_version":"8.1.0(tasmota)","manufacturer":"Tasmota"},"~":"tasmota_lamp1/tele/"} (retained)
17:35:23 MQT: tasmota_lamp1/tele/STATE = {"Time":"2025-02-18T17:35:23","Uptime":"0T00:00:12","UptimeSec":12,"Heap":27,"SleepMode":"Dynamic","Sleep":10,"LoadAvg":98,"MqttCount":1,"POWER":"ON","Dimmer":44,"Color":"112,23","HSBColor":"0,0,0","Channel":[44,9],"CT":213,"Fade":"ON","Speed":2,"LedTable":"ON"}
17:35:40 MQT: tasmota_lamp1/stat/RESULT = {"POWER":"ON"}
17:35:40 MQT: tasmota_lamp1/stat/POWER = ON
17:35:41 MQT: tasmota_lamp1/tele/STATE = {"Time":"2025-02-18T17:35:41","Uptime":"0T00:00:30","UptimeSec":30,"Heap":26,"SleepMode":"Dynamic","Sleep":10,"LoadAvg":99,"MqttCount":1,"POWER":"ON","Dimmer":72,"Color":"184,38","HSBColor":"0,0,0","Channel":[72,15],"CT":213,"Fade":"ON","Speed":2,"LedTable":"ON"}
17:35:41 MQT: tasmota_lamp1/stat/RESULT = {"POWER":"ON","Dimmer":72,"Color":"184,38","HSBColor":"0,0,0","Channel":[72,15],"CT":213}

Version 8.1 is ancient. The current version is 14.5.

Yes, that’s why you needed to set option 19 to 1. I doubt version 8.1 even supports Tasmota’s style of MQTT Discovery.

If you never, ever intend to upgrade to a current version of Tasmota, you’re fine.

If you might upgrade, do it now and switch to using Tasmota’s MQTT Discovery (SetOption19 0). It will save you a lot of work in the future (because the current version of Tasmota doesn’t support Home Assistant’s MQTT Discovery).

Be advised there’s no direct update path from 8.1 to 14.5. Your version is so old it must upgraded in steps. Refer to Upgrade Flow.

Uhhh is it not because of the old version that HA the status that is returned is not properly processed?

What happens if I update higher than 9.1
Tasmota devices flashed with version 9.2, or later (tasmota-lite.bin does not support this integration).



thanks for the tip!!

I have now updated it to Veris 8.1.5 But now the lamp is no longer added with SetOPOTION19 1 or with SetOPOTION19 0

And now?

Keep upgrading until the latest version.

Then ensure SetOption19 is 0 and install the Tasmota integration. The device should then be automatically detected by Home Assistant.

1 Like

It worked, I first had to upload a mini update and then the lite again.
Is always exciting that kind of updates.

It now works as I see everywhere on youtupe

1 Like

The following is that I now want a slider (as I had) with which I adjust the fierceness together with the color. So a small slider in the dasboard.

Is that possible?

I have this working (incl sync) for the brightness slider.

configuration.yaml (also can make a input_numers.yaml)

input_number:
  brightness:
    name: Brightness
    initial: 0
    min: 0
    max: 100
    step: 1
    unit_of_measurement: "%"
    icon: mdi:brightness-6

automations.yaml

- id: brightness
  alias: 'Brightness'
  trigger:
    platform: state
    entity_id: input_number.brightness
  action:
  - service: light.turn_on
    entity_id: light.tasmota_keuken_11
    data_template:
      brightness: "{{ (states('input_number.brightness') | float / 100 * 255) | int }}"


- id: update_brightness
  alias: 'Sync brightness from light'
  trigger:
    platform: state
    entity_id: light.tasmota_keuken_11
    attribute: brightness
  action:
    - service: input_number.set_value
      data:
        entity_id: input_number.brightness
        value: "{{ (state_attr('light.tasmota_keuken_11', 'brightness') | float / 255 * 100) | round(0) }}"

I have done the same with the color temp :slight_smile:

configuration.yaml

input_number:
  color_temp:
    name: Color Temperature
    initial: 300
    min: 153
    max: 500
    step: 1
    unit_of_measurement: "mireds"
    icon: mdi:temperature-kelvin

automations.yaml

- id: set_color_temp
  alias: 'Set Light Color Temperature'
  trigger:
    platform: state
    entity_id: input_number.color_temp
  action:
    - service: light.turn_on
      entity_id: light.tasmota_keuken_11
      data_template:
        color_temp: "{{ states('input_number.color_temp') | int }}"

- id: sync_color_temp
  alias: 'Sync Color Temperature from Light'
  trigger:
    platform: state
    entity_id: light.tasmota_keuken_11
    attribute: color_temp
  action:
    - service: input_number.set_value
      data:
        entity_id: input_number.color_temp
        value: "{{ state_attr('light.tasmota_keuken_11', 'color_temp') | int }}"