Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MQTT standalone #69

Open
siouxme opened this issue Nov 29, 2018 · 27 comments
Open

MQTT standalone #69

siouxme opened this issue Nov 29, 2018 · 27 comments

Comments

@siouxme
Copy link

siouxme commented Nov 29, 2018

Will it be possible to reuse an existing MQTT broker, rather then be depend on the internal MQTT service inside the adpater? It would be helpful to just specifiy the MQTT IP and port of the existing infrastructure....

@cimba007
Copy link

cimba007 commented Dec 4, 2018

Yeah. I don't want to rely on a "client" to bring its own mqtt-server.

@gbomacfly
Copy link

Same here, I have a mosquitto server running. I wish this module could be a client instead of a server.

@steff517
Copy link

steff517 commented Feb 4, 2019

The same here

@ackerschott
Copy link

I´d also like to use my independent mosquitto server.

@LaLinea
Copy link

LaLinea commented Nov 26, 2019

I can support this feature request too! I have to use a dedicated broker because sensor data has to go directly over the broker to an influx db too.

@merlin2533
Copy link

That is a great feature, how can we support that we have implementation.
e.g. Adapter MQTT Server, would be a nice adaption in this case?

@merlin2533
Copy link

there would be fine when only one server will be need for both cases

@mobilutz
Copy link
Contributor

mobilutz commented Dec 28, 2019

I did look into this topic a little bit just now, and it does not seem to be too easy to completely switch to an existing MQTT broker.

There is one big issue, which means that it is not enough to just change the MQTT broker:

  1. mqtt messages from sonoff/tasmota do not include any client information

From what I know right now, there would be a manual change on ALL tasmota devices, to include the client inside the mqtt topic. I will not look into this further, because I don't think that this is a very good way to go, right now.

@merlin2533
Copy link

ok thats also fine, when you have the option to do a bridgeing to a other server
or the other option is, that you work with the adapter MQTT toether that he is able to get the information out of the mqtt server from sonoff.

In my infastructure, at the moment, i have to double the mqtt server, that i have one ony for the sonoff/tasmota and other for the rest

@LaLinea
Copy link

LaLinea commented Jan 2, 2020

In all my setups I use a unique module host name in the MQTT topic on all tasmota devices. So there is the ‚client information‘ in the topic. It‘s also necessairy for my sensor database in influxdb.

@LaLinea
Copy link

LaLinea commented Jan 21, 2020

could someone help solving this with bridging on the central mosquitto MQTT broker? So the mosquitto could bridge to the sonoff adapter on iobroker? Any help would be appreciated

@Michael-CGN
Copy link

I would also very much appreciate adding support for an external mqtt server into this module. I spent hours trying to solve the problem having a mosquitto server bridging to sonoff module. As the module relies on the name of the client connected to create the instances, it pastes everything under the client id of the mosquitto bridge instead the appropriate tasmota devices...

@kskenyon
Copy link

I'll pile on. External MQTT server as an option would be appreciated.

@debouttek
Copy link

I like this to.

@MNatzke
Copy link

MNatzke commented Jun 8, 2020

I like this too.

To be honest. I think it is not the idea of the MQTT protocol to have many servers for different "vendors"/"types" of IoT devices. I have one server running and this one should handle all my use cases.

@Apollon77
Copy link
Collaborator

Ok, but its then the "mqtt" or "mqtt-client" adapter not suitable for you?

The thing here is that ease of use for unexperienced users ...

Also if it would connect to a different mqtt server we would need some kind of "what states to subscrube that are the sonoffs to handle by this adapter" because there will be much more data in it not handleable by this adapter.

So: How it could work from your idea? Can someone write such an idea down to discuss?

@MNatzke
Copy link

MNatzke commented Jun 9, 2020

Hi Apollon,

I am not sure if we are on the same page or if I understand the architecture of the adapter (I kind of new to iobroker).
What I understand is: The Adapter sonoff is acting like a mqtt-broker. It is listening on the IP of the iobroker on Port 1883 (or something else if i change it) for MQTT-Messages. If i want that my tasmota/sonoff devices work with the adapter i have to use the iobroker (IP) with the port configured in the sonoff Adapter as an MQTT-Broker (in the tasmota-Setup).

As the Adapter is not a "real" MQTT-Broker it is not possible to listen or subscribe to it with tools like mqtt.fx (at least it does not work for me in my configuration) or other clients from different servers. In that case I can use my tasmota devices only with the iobroker adapter and with nothing else (like nodeRed on a different server).

I am not sure how the mqtt or mqtt-client adapters might help at this point. The Tasmota devices will still work only with the sonoff adapter. Or is your recommendation to use mqtt-Client instead of sonoff client?

The setup I prefere is to have a sonoff adapter with all the sonoff specific setup (topic etc.) is acting as a client and can subscribe to any mqtt Broker in the network. When i got your issue correct the problem is that you need to know if the messages are sent by a tasmota or sonoff device to know that the messages are relevant. If you use the command "Status 2" you will be able to see that a device is a tasmota device.
Another option would be to configure the "groupTopic" of the Tasmota devices (default: tasmotas or sonoffs) in the adapter. The adapter cab perform a status request for the configured group to collect all devices.

@mstuebner
Copy link

One more vote for using an existing mqtt server. Especially because I do not understand the difference whether this sonoff adapter get the tasmota data by acting as a broker or by acting as a client. The data is the same.

Would be great if mobilutz could add some more information what he ment with "mqtt messages from sonoff/tasmota do not include any client information", because all data comes from the /STATE channel?

@klein0r
Copy link

klein0r commented Aug 18, 2020

+1 for an option to connect to an external broker (instead of hosting an additional one with this adapter).

@TheHaf
Copy link

TheHaf commented Oct 26, 2020

I second that, +1 for the option to use an external server like mosquitto.

@GermanBluefox
Copy link
Contributor

I second that, +1 for the option to use an external server like mosquitto.

No one is stopping you to implement it.

@TheHaf
Copy link

TheHaf commented Nov 30, 2021

I would if I could. 😄 I currently lack the time and knowledge.

@jwiesel
Copy link

jwiesel commented Dec 1, 2021

great discussion! Also a +1 from my side.
I've been using mosquitto + iobroker.node-red so far with the drawback, that I need to connect every new tasmota device to sync state/sensor in a flow in Node-RED to store & update values in IOBroker objects.
A great feature I'd like to use is the "automatic object creation and sync" this adapter seems to provide (I couldn't test it, yet).

From the comments I guess what would be needed to be implemented:

  • dropdown to choose between "inbuilt MQTT broker" or "external MQTT broker"
  • Field to enter external MQTT broker's IP address
  • (optionally) extra field to enter port of external MQTT broker - maybe existing port field could be reused
  • Application logic to start and connect MQTT client instead of MQTT broker, if new option is selected

The first three points should not be a big deal, but I am not sure about the critical last one (application logic).

Regarding the message handling (MQTT topics) I guess there would not be a big change, as the device name of each tasmota would be different.

@Apollon77
Copy link
Collaborator

There was also an other discussion with the idea to better start a new "tasmota" adapter which works as generic as mqtt but is able to "handle JSONs ina generic way" ... In fact this would mean that roles and datatypes and such will not be that perfectly set , but the maintenance effort to update all these json structures (that are not standardized at all ) would be gone

@jwiesel
Copy link

jwiesel commented Dec 1, 2021

If I got your comment right, the issue is, that tasmota messages e.g. tele/deviceName/STATE contain a json structure.
Transferring that standardized JSON structure to separate objects/states in ioBroker from my point of view is a beautiful feature as the data is automatically accessible for all tasmota devices.
If users decide to publish custom MQTT messages via rules in Tasmota that's a different story, but maybe not a core feature for standard users.

@Apollon77
Copy link
Collaborator

In fact I (personally) understood that adapter to try to transform the "a bit standardized messages from sonoff devices" into clean ioBroker structures ... but over time anything became Tasmota and got very divers ... so question is if it makes sens to continue here or to continue clean as new adapter with a more generic purpose ... with the downside that "roles" and such details gets lost ...

jbubik added a commit to jbubik/ioBroker.sonoff that referenced this issue Jan 31, 2022
Issues ioBroker#69 and ioBroker#10 show, that there is not enough documentation for the different MQTT speaking Adapters.
Here I propose a comparison table that would save some people time and effort looking for the right Adapter.
Table can be expanded to hold more info. If there are mistakes I do apologize!
@smischke
Copy link

I have many tasmota smart plugs and also came to the requirement to connect them to a separate mqtt broker (mosquitto) since I'm trying to run iobroker and home assistant in parallel. I've configured mosquitto to connect a bridge to ioBroker.sonoff now listening on port 1884:

listener 1883 0.0.0.0
allow_anonymous false
password_file /etc/mosquitto/pwfile

connection sonoff
address 127.0.0.1:1884
topic # out
cleansession false
notifications false
remote_clientid bridge
remote_username tasmota
remote_password tasmota
start_type automatic
bridge_insecure false

Since ioBroker.sonoff currently recognizes devices by clientId (which is "bridge" for all devices) and not by topic, I've made a quick and dirty hack as a proof of concept:

Now it looks like this in iobroker:

I'm sure this hack won't work in every situation and maybe there is a better way. Ideally, switching to "bridge mode" should be absolutely transparent and use the existing states. And since I'm not so experienced in javascript and iobroker, I'd like this comment to be understood as a feature request "support bridge mode" and handled by the authors of this adapter or someone more experienced. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests