AtomBaf / homebridge-mqtt-tasmota

Homebridge handler for tasmota/MQTT devices
MIT License
5 stars 5 forks source link

Not compatible with custom topics ? #8

Closed bakman2 closed 1 year ago

bakman2 commented 1 year ago

I am using a different prefix (because i dislike the default topic setup from tasmota)

image

This does not seem to work with this plugin. I enabled the "debug" option, where am I supposed to the see the output ? In the default homebridge log ? Don't see anything there.

AtomBaf commented 1 year ago

Hi @bakman2 As you can see here for instance there is a topic setting for each accessory type and from which every MQTT topics is derived according to the default tasmota settings.

For instance, in one of my switch I have in the topic settings veranda_switch_ceiling (without slash) which will result in the following MQTT topics:

As far as I understand from your settings, the topic is tasmota/kleine_kamer/fan so the device will listen/publish on theses topics:

If this is right, then setting topic to tasmota/kleine_kamer/fan in your accessory json file will be good enough:

        {
            "accessory": "mqtt-tasmota",
            "type": "lightbulb",
            "name": "Mein Kleine Kamer",
            "url": "mqtt://192.168.50.15",
            "topic": "tasmota/kleine_kamer/fan"
        }
bakman2 commented 1 year ago

Thanks for your response.

Perhaps I should have clarified that I was referring to the %prefix%.

The topics will become:

tasmota/kleine_kamer/fan/cmnd/POWER
tasmota/kleine_kamer/fan/tele/STATE
...
AtomBaf commented 1 year ago

Ok understood. Then the only one way to setup the device is to explicitly type all topics in the configuration file. Since your device looks like a fan, you can find all topics related to fans here

In your example, it could be:

        {
            "accessory": "mqtt-tasmota",
            "type": "fan",
            "name": "Mein Kleine Kamer",
            "url": "mqtt://192.168.50.15",
            "resultTopic": "tasmota/kleine_kamer/fan/stat/RESULT",
            "commandTopic": "tasmota/kleine_kamer/fan/cmnd/FANSPEED",
            "commandStateTopic": "tasmota/kleine_kamer/fan/cmnd/STATE",
            "teleTopic": "tasmota/kleine_kamer/fan/tele/STATE"
        }
AtomBaf commented 1 year ago

I can probably add a new parameter, like "fullTopic": "%prefix%/%topic%/" or "fullTopic": "%topic%/%prefix%/" to ease the process, let me have a look

AtomBaf commented 1 year ago

Released, now you can set your accessory with:

        {
            "accessory": "mqtt-tasmota",
            "type": "fan",
            "name": "Mein Kleine Kamer",
            "url": "mqtt://192.168.50.15",
            "topic": "tasmota/kleine_kamer/fan",
            "fullTopic": "%topic%/%prefix%/"
        }
bakman2 commented 1 year ago

@AtomBaf it works nicely thanks. One issue though, if you add a new accessory via GUI, the "fullTopic": "%topic%/%prefix%/" gets removed from the config for all accessories.

AtomBaf commented 1 year ago

thx for spotting this @bakman2, it is now fixed as of version 0.9.0