Page 1 of 1

MQTT#Connected and MQTTimport#Connected

Posted: 31 Dec 2020, 20:52
by pw444
Hya,

while digging the documentation, i've found MQTT#Connected and MQTTimport#Connected

Whats is the difference between these, and when, according the developers, shall one or other be used and which are the benefits?

Thx in advance.

Re: MQTT#Connected and MQTTimport#Connected

Posted: 01 Jan 2021, 11:28
by Ath
They used to be triggered by different connection-clients, but now that MQTT Import is 'piggy-backing' on the regular (first enabled) MQTT Controller connection, they are practically the same. For backward compatibility, the MQTTImport events still exist, and one can choose to use that where appropriate, plus, they won't be fired while the MQTT Import plugin task is disabled (which can be enabled/disabled from the rules), so having separate events is useful, IMHO. And, you can decide what best fits you application.

Re: MQTT#Connected and MQTTimport#Connected

Posted: 01 Jan 2021, 12:37
by TD-er
Yep, what Ton said.

MQTT#connected/disconnected are events originally only related to the MQTT controllers.
MQTTimpor#connected/disconnected are events originally related to the MQTT import plugin.

A few weeks ago I changed the code so MQTT import uses the same MQTT client as the controller (since they already shared the same credentials) to save resources as each MQTT client instance uses over a kB of RAM.

Re: MQTT#Connected and MQTTimport#Connected

Posted: 01 Jan 2021, 15:17
by pw444
Thx for the explanation.