Code Monkey home page Code Monkey logo

Comments (10)

arendst avatar arendst commented on May 12, 2024

Well the fall back topic is equal to the MQTT Client as the client has to be unique for MQTT to work. Using this feature every sonoff can still be addressed even if you have (accidently) set two sonoffs to the same Topic.

I never thought of the fact where someone would use the same name for both fall back topic AND Topic. I do not recommend it as it makes unique identification difficult.

If you first set MQTTClient and then want to set Topic using the same name the software does not allow it and sets Topic to the default as in user_config.h. I do not check the other way round and that's probably how you did it.

A name with a dash as in sonoff-1234 as Topic is perfectly fine. Same for MQTTClient.

from tasmota.

ThomDietrich avatar ThomDietrich commented on May 12, 2024

Understood. That's more or less as I expected it. Thanks for explaining

In that case I would like to continue with the suggestion to default to a unique name for the Topic. Defaulting to "sonoff" doesn't make sense if you own more than one module - which is most likely for 99% of Sonoff users...

Additionally I did not understand your decision to work with two id schemes, the last six MAC digits and a four digit decimal I can not relate to. Might be beneficial to use the MAC scheme only, wdyt?

from tasmota.

arendst avatar arendst commented on May 12, 2024

Will look into topic uniqueness

from tasmota.

arendst avatar arendst commented on May 12, 2024

No need for topic uniqeueness as the fall-back topic is already unique.

The standard topic is set to sonoff so that when one new sonoff is flashed the user can configure it right away accessing it by the topic cmnd/sonoff/... The first thing to do than is renaming it to a user known unique name.

The use of the four digits decimal is a consequence of keeping unique hostnames as short as 15 character to satisfy Windows WINS Netbios naming.

from tasmota.

ThomDietrich avatar ThomDietrich commented on May 12, 2024

configure it right away accessing it by the topic cmnd/sonoff/... The first thing to do than is renaming it to a user known unique name.

For that purpose one can subscribe on cmd/+. That's how MQTT is designed... http://www.hivemq.com/blog/mqtt-essentials-part-5-mqtt-topics-best-practices

How would one deal with multiple freshly flashed modules? They would all receive the same new settings. If a user does the configuration via http (as most probably do) the default topic doesn't matter, it's just a nuisance to change it... In both cases a unique topic to begin with would have been easier.

Don't get me wrong, you know that I'm a fond user of your firmware! The process is simply a bit unclear. I'm not sure how a less experienced user will deal with these things. Intuitive usability is sometimes hard to get right. If "The first thing to do than is renaming it to a user known unique name." is part of your intended process, would be good to at least document it somewhere.

from tasmota.

arendst avatar arendst commented on May 12, 2024

using cmnd/+ addresses all devices in your environment and not just a few sonoffs (I have many different models like tickers, lcds, lights all not using this software). This does NOT address a unique device. So a grouptopic to address same kind of firmware is just a need.

The user selectable unique topic is a pet name used for all outgoing communication and is therefore mandatory.

Dealing with multiple new installs is done using the fallback topic so no problem at all.

Finally this software is to be used by someone willing to invest some time in getting to know a little about MQTT. All other features are making it nice to have.

from tasmota.

ThomDietrich avatar ThomDietrich commented on May 12, 2024

I agree that we disagree πŸ˜ƒ
However I think we both made our point and what you are saying is totally valid of course.
I've added a few details to the wiki: https://github.com/arendst/Sonoff-Tasmota/wiki/Initital-Configuration

from tasmota.

ThomDietrich avatar ThomDietrich commented on May 12, 2024

@arendst great to see you've added a lot of sensors content. I did create the following menu entry/article for that: https://github.com/arendst/Sonoff-Tasmota/wiki/Hardware-Modification

Just so you know. You might want to delete the menu entry, rename the Initital-Configuration article or move the content. As you prefer.

from tasmota.

RyanEwen avatar RyanEwen commented on May 12, 2024

I am reviving this just to say that +1 it would be great of the default MQTT topic unique like the MQTT_CLIENT_ID.

I am about to flash over 10 of these and I was hoping not to have to set them up at all afterwards. My plan was to plug them in one at a time and press the button on them to get the topic from mqtt-spy and then assign the discovered topic to a switch in openHAB.

I was hoping to do something like this but it doesn't get translated into a unique value and is instead taken literally:
#define MQTT_TOPIC "sonoff_%06X"

Is there a way to make that dynamic like the client id?

from tasmota.

RyanEwen avatar RyanEwen commented on May 12, 2024

Nevermind.. I see that this is supported in the development branch according to #2409

from tasmota.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.