Author Topic: MQTT Client Plugin  (Read 31140 times)

Offline Snaxmuppet

  • Newbie
  • *
  • Posts: 17
  • Karma: +1/-0
Re: MQTT Client Plugin
« Reply #30 on: January 21, 2016, 08:12:25 am »
Fair enough... I shall monitor it now it is working (and still working) :)

Offline xAPPO

  • Jr. Member
  • **
  • Posts: 95
  • Karma: +6/-8
Re: MQTT Client Plugin
« Reply #31 on: January 29, 2016, 01:15:36 pm »
Hi,

  Well done for publishing this. I shall give it a try this weekend.  Just wondering if you plan to add support for subscribing to a topic at some time , for updates into Vera , or if the solution already meets your needs ?
xAP, Fibaro HC2, Vera 3 Lite Edge Plus , SmartThings, HomeVision, Home Automation Hub, Hue, LIFX, C-Bus, Sonos, Barionet, Crestron, AMX, Loxone, Harmony, HouseBot, HomeSeer, Indigo, MQTT, IFTTT, IOLogix, 1-wire, IDRATek.

Offline SchattenMann

  • Sr. Newbie
  • *
  • Posts: 42
  • Karma: +4/-1
Re: MQTT Client Plugin
« Reply #32 on: January 29, 2016, 01:17:53 pm »
To be honest that doesn't sound like something I would need since I'm moving all my logic away from Vera but I may take a look at it when and if I have the time...of course if any one wants to jump in and do it that would be great!

Offline cybrmage

  • Hero Member
  • *****
  • Posts: 1104
  • Karma: +113/-41
Re: MQTT Client Plugin
« Reply #33 on: January 29, 2016, 01:34:04 pm »
Just wondering if you plan to add support for subscribing to a topic at some time , for updates into Vera

To be honest that doesn't sound like something I would need since I'm moving all my logic away from Vera but I may take a look at it when and if I have the time...of course if any one wants to jump in and do it that would be great!

I have actually worked on an MQTT client for my Caseta Connect plugin (based on a newer version of the paho client than yout plugin uses)... The Caseta Smartbridge uses an MQTT broker for status notifications. The problem is that to get timely subscription notifications (ie: instant status), you need asynchronous IO, not polled IO. I solved this by rewriting the paho client to use the Vera IO subsystem...

You are welcome to take a look at the Caseta Connect plugin to see how this was done... The Client is embedded in the L_CasetaConnect.lua file... and the incoming IO is in the I_CasetaConnect.xml file...


Offline xAPPO

  • Jr. Member
  • **
  • Posts: 95
  • Karma: +6/-8
Re: MQTT Client Plugin
« Reply #34 on: January 30, 2016, 05:48:18 am »
Great - I'll take a look this weekend hopefully

   I implemented an asynchronous TCP socket handler for my Vera xAP plugin - so I had that in my toolbox,  but if you've already got that integrated with the paho client that makes it so much easier...

Kevin
xAP, Fibaro HC2, Vera 3 Lite Edge Plus , SmartThings, HomeVision, Home Automation Hub, Hue, LIFX, C-Bus, Sonos, Barionet, Crestron, AMX, Loxone, Harmony, HouseBot, HomeSeer, Indigo, MQTT, IFTTT, IOLogix, 1-wire, IDRATek.

Offline gregl

  • Full Member
  • ***
  • Posts: 187
  • Karma: +9/-3
Re: MQTT Client Plugin
« Reply #35 on: March 09, 2016, 07:29:50 pm »
Really great work creating this!

Any plans to be able to control via MQTT a device on Vera?


Offline SchattenMann

  • Sr. Newbie
  • *
  • Posts: 42
  • Karma: +4/-1
Re: MQTT Client Plugin
« Reply #36 on: March 10, 2016, 04:48:53 am »
Really great work creating this!

Any plans to be able to control via MQTT a device on Vera?

Not for now...still deciding on how to move forward

Offline vosmont

  • Hero Member
  • *****
  • Posts: 687
  • Karma: +60/-8
Re: MQTT Client Plugin
« Reply #37 on: March 10, 2016, 06:42:00 am »
You simply set which variables you want to monitor and all devices with those variables will publish status updates - you may then subscribe only the Topics you actually want to monitor but odds are if you need MQTT you're using something like node-red for all your logic and this is a huge help

Hello SchattenMann,
I'm discovering Node-red and MQTT.

I've played a little with "Node-red" and found that it's a bit hard to describe complex scenarios without coding it in functions.
Besides it seems that it's difficult to identify the Vera's devices in the UI when a lot are involved in a flow.

Can you make us a return on the use of MQTT with Node-red ?

Really great work creating this!

Any plans to be able to control via MQTT a device on Vera?

Not for now...still deciding on how to move forward

you can call action URL on device, or create a handler in your plugin to emulate a webservice (you will have more possibilities)

Offline stefaanbolle

  • Jr. Member
  • **
  • Posts: 52
  • Karma: +4/-1
Re: MQTT Client Plugin
« Reply #38 on: March 11, 2016, 07:27:15 am »
My MQTT broker requires username / password authentication.
Would it be possible to add a username and password variable so authentication parameters can be passed to the broker for publishing messages?

Offline SchattenMann

  • Sr. Newbie
  • *
  • Posts: 42
  • Karma: +4/-1
Re: MQTT Client Plugin
« Reply #39 on: March 11, 2016, 07:29:53 am »

Can you make us a return on the use of MQTT with Node-red ?

Not sure I understood what you meant

Would it be possible to add a username and password variable so authentication parameters can be passed to the broker for publishing messages?

Hmm yes, I'd completely forgot about that...need to take a look at it

Offline vosmont

  • Hero Member
  • *****
  • Posts: 687
  • Karma: +60/-8
Re: MQTT Client Plugin
« Reply #40 on: March 12, 2016, 08:02:48 am »

Can you make us a return on the use of MQTT with Node-red ?

Not sure I understood what you meant
As you talked about Node-RED, I thought that you had tested MQTT with it.


Offline SchattenMann

  • Sr. Newbie
  • *
  • Posts: 42
  • Karma: +4/-1
Re: MQTT Client Plugin
« Reply #41 on: March 31, 2016, 01:18:44 pm »
As you talked about Node-RED, I thought that you had tested MQTT with it.

Well I do, that's pretty much the only reason why I've made this plugin :-)

All you need to do is to monitor the topic you want and react accordingly

Offline djassa1

  • Sr. Newbie
  • *
  • Posts: 29
  • Karma: +0/-0
Re: MQTT Client Plugin
« Reply #42 on: April 03, 2016, 07:41:40 am »
Nice plugin, thanks. Exactly what i was looking for to connect different home automation boxes and send infos from my Veralite which is running UI5  :(

I was able to load the plugin and it is connecting to the broker correctly but I am unable to save watchers and alias probably because it's using a method only available in UI7.

Could you just tell me in the advanced settings of the plugin, how the variables are set? I have empty values like this (not saved):

mqttWatches   {}
mqttAlias   {}

Thanks for you help

Offline SchattenMann

  • Sr. Newbie
  • *
  • Posts: 42
  • Karma: +4/-1
Re: MQTT Client Plugin
« Reply #43 on: April 04, 2016, 10:29:42 am »
Nice plugin, thanks. Exactly what i was looking for to connect different home automation boxes and send infos from my Veralite which is running UI5  :(

I was able to load the plugin and it is connecting to the broker correctly but I am unable to save watchers and alias probably because it's using a method only available in UI7.

Could you just tell me in the advanced settings of the plugin, how the variables are set? I have empty values like this (not saved):

mqttWatches   {}
mqttAlias   {}

Thanks for you help


Actually I've installed it on my Vera Lite UI5 and noticed the same problem.
Looks like UI5 gets all messed up when displaying a JSON variable, no idea why and won't bother with it for now.
I've made a few tweaks that should make it work in UI5 (even though Vera won't display the values correctly)  - files attached.

Note: don't forget to clear browser cache and restart LUA after uploading new files.

Offline SchattenMann

  • Sr. Newbie
  • *
  • Posts: 42
  • Karma: +4/-1
Re: MQTT Client Plugin
« Reply #44 on: April 04, 2016, 10:31:43 am »
I've also added a new variable mqttVeraIdentifier that acts as an unique identifier on the MQTT server.
It will also change the Topic where the message is posted to mqttVeraIdentifier/events/device ID or alias