MQTT Client implementation

@4integration:
I was thinking about also using json to publish messages to MQTT, but I can’t reproduce the way you use the JSON module, on calling json:encode, I get:
LuaInterface::CallFunction_Startup-1 device 106 function startup failed [string “…”]:62: attempt to call method ‘encode’ (a nil value)
Are you sure the JSON module you put in your zipfile is the one that is running on your vera?

av

@averell
I downloaded the files again and also tried to remove JSON.lua from /usr/lib/lua and then I get

LuaInterface::CallFunction_Variable func: watchSensorVariable Device_Variable 102 urn:micasaverde-com:serviceId:EnergyMetering1:Watts failed [string "module("L_SensorMqtt1", package.seeall)..."]:77: attempt to call method 'encode' (a nil value)

Putting it back again it works, so it’s the JSON I use

Have you put it into that directory?
Do you load the lib?

package.loaded.JSON = nil json = require("JSON")

@ 4integration:
I didn’t put JSON.lua in that directory, so that might just be it, I just uploaded it like the other files. I didn’t get any arrors on the require part, so it seemed to load ok. I will try it again, I just wrote my own small concatenation to create a JSON string, snd was now working on the other end, displaying the events using angular.js.
I will give it another try, thanks for your reply :slight_smile:

My framework is now shaping up, I implemented 3 (actually 4) things now. The first is sending out events for all zwave devices that are directly controlled by the Vera. That way my central component on node.js will know those statusses. Works quite will, except for Duwi dimmers, they don’t report back at all if I manually change the lights.
The second is updating the display values of devices such as temperature and power devices. They get updated every few seconds or so. The third one is sending out direct command for some devices, in my case a few switches and shutters that I control from my arduino devices. Here I didn’t use the events only, but implemented the actions per child device. A fourth function I implemented only for making sure both controllers (Vera and my node.js based solution) stay in sync, which is an inform request over MQTT, which leads to the vera status of all devices to be sent over MQTT.
Directly switching on devices on vera I still do via HTTP, as long as the LUA implementation of MQTT client is still not asynchronous (which I feel might be the case forever).

As I’m working on both node.js, angular.js, learning LUA and learning about the vera, and also building the arduinos and my raspberry pi, it might be a while before it all works the way I want, but I’ll try to copy a still very rudimentary version of the plugin asap.

Av

@averell - any chance you’d be able to share your code for the Vera side of things? I’m also building a central “coordinator” for my home control stuff with MQTT for message passing. I just picked up a Veralite to add to my other stuff, and it sounds like you’ve pretty much implemented exactly what I’d like to be able to do - just have the Vera publish all its events via MQTT, so I can consolidate them with my central control. Triggering controls on the Vera is fine with the web api…

Matt

I’m with Matlock on this one, any chance of getting your stuff shared, I want to be able to publish mqtt events when things happen in Vera as well…

Hows the progress on the MQTT plugin going? Im keen to use MQTT with Vera also.

Me too. If possible please share.

I even registered to write back here. :slight_smile:

Another way of doing it for me as I already have OpenHAB running since about 6 months is to simply use the MIOS binding. Through that I could get OpenHAB to MQTT the status changes.

Topic subscribed.

Interested too. Replying to subscribe…

just wonder does any one have any user guide for setup mqtt in vera 3

Just setting up a new HA system that integrates with Open Energy Monitor and some Arduinos and so I would benefit a lot from having MQTT available on my new Vera Edge.

Where are we with a working MQTT interface?

This may help http://forum.micasaverde.com/index.php/topic,35848.0.html

hello gang do you know if the vosmont/vera-mqtt is still working im no able to tu see the “mqttTarget” and “mqttTopic”. and dont see enything in the log