This repository has been archived by the owner on May 7, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 787
Unable to use MQTT Last Will and Testament with dynamic data #5162
Comments
Hi @doandzhi, how do you configure the MQTTService? In case you do it by a service *.cfg file you can use the |
Thanks for the answer @htreu , really appreciated! I was more interested in building the payload with a timestamp and some dynamic data that is not possible to hardcode at the moment. Maybe the best approach is starting the connection 'by hand' and not rely on |
doandzhi
changed the title
Unable to use MQTT Last Will and Testament
Unable to use MQTT Last Will and Testament with dynamic data
Mar 2, 2018
The API needs adjustment. It is a valid Use-case to change the lw even after the session is initiated |
davidgraeff
pushed a commit
to davidgraeff/smarthome
that referenced
this issue
Mar 19, 2018
davidgraeff
pushed a commit
to davidgraeff/smarthome
that referenced
this issue
Mar 29, 2018
…more. * Remove name from MqttBrokerConnection. This is only necessary for the MqttService. Consumers of MqttBrokerConnection should not be bothered with that detail. * Remove textConfigured flag. Again this is not interesting for anything outside MqttService. * Don't parse configuration parameters ourself, but use a configuration values class instead. * Adapt to Nullable usage. * Mqtt: Introduce service factory service MqttBrokerConnectionServiceInstance * ESH compatible implementation of the service factory pattern including a config description for GUIs * Add MqttService.setLastWill method. Fixes eclipse-archived#5162 Signed-off-by: David Graeff <david.graeff@web.de>
htreu
pushed a commit
that referenced
this issue
Mar 29, 2018
…more. (#4173) * Remove name from MqttBrokerConnection. This is only necessary for the MqttService. Consumers of MqttBrokerConnection should not be bothered with that detail. * Remove textConfigured flag. Again this is not interesting for anything outside MqttService. * Don't parse configuration parameters ourself, but use a configuration values class instead. * Adapt to Nullable usage. * Mqtt: Introduce service factory service MqttBrokerConnectionServiceInstance * ESH compatible implementation of the service factory pattern including a config description for GUIs * Add MqttService.setLastWill method. Fixes #5162 Signed-off-by: David Graeff <david.graeff@web.de>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I am using
ESH version 0.9.0 io.transport.mqtt
bundle and trying to implement a custom plugin for MQTT. Having a look into the code I saw that it is pretty straightforward and well structured, thanks for this!One concern of mine is the MQTT Last Will and Testament functionality. Creating an instance of the given class
MqttWillAndTestament
and passing it to the.setLastWill()
method of theMqttBrokerConnection
didn't work at all.Digging into the code of this
MqttBrokerConnection
class I see that this field is used for building theMqttConnectOptions
object in thecreateMqttOptions()
. This object is passed to the.connect()
method oforg.eclipse.paho.client.mqttv3.MqttAsyncClient
later in theMqttBrokerConnection.start()
.My headaches start here: When I configure the MqttService for a given brokername and later use its
.getBrokerConnection()
method passing the corresponding broker name the mentioned things has already happened. Although I get a proper connection and I am able to publish or subscribe using this connection I have no LWT. The problem comes when I have to set this Last Will which by the time of creation of this connection is null. With apologies for my ignorance I ask you for advice/ help.@davidgraeff Since you are deeply involved in the io.transport.mqtt bundle's implementation I would be very glad if you share your opinion on this one.
The text was updated successfully, but these errors were encountered: