dvv / nodemcu-thingies

Assorted set of small Lua modules for nodemcu-firmware
57 stars 16 forks source link

MQTT queue helper: bad argument #1

Closed gorootde closed 8 years ago

gorootde commented 9 years ago

Hi,

I'am trying to use your mqtt-queue-helper script in one of my projects. I call it exactly as described in the header of the file.

mqttclient=mqtt.Client("frontdoor",120)
local pub = dofile("mqtt-queue-helper.lua")(mqttclient)
pub("/frontdoor/state","online",1,1)

The error I get is:

NodeMCU 0.9.5 build 20150318  powered by Lua 5.1.4
PANIC: unprotected error in call to Lua API (mqtt-queue-helper.lua:22: bad argument #2 to 'publish' (string expected, got nil))
PANIC: unprotected error in call to Lua API (bad argument #4 (number expected, got no value))
PANIC: unprotected error in call to Lua API (bad argument #5 (number expected, got no value))

I can't figure out why one of the tp variables is nil. What is causing this issue?

pastukhov commented 9 years ago

Same for me

local pub = dofile("mqtt-queue-helper.lua")(mqtt)
pub("home/sensors/temperature","10",0,0)
end
marcelstoer commented 9 years ago

With https://github.com/nodemcu/nodemcu-firmware/commit/32e062f52333541d27ab44c105b81b92baa24c5e MQTT queueing landed in the firmware. It's available in release 0.9.6-dev_20150331 or newer.

dvv commented 9 years ago

Thanks!

On Thu, May 7, 2015 at 1:45 PM, Marcel Stör notifications@github.com wrote:

With nodemcu/nodemcu-firmware@32e062f https://github.com/nodemcu/nodemcu-firmware/commit/32e062f52333541d27ab44c105b81b92baa24c5e MQTT queueing landed in the firmware. It's available in release 0.9.6-dev_20150331 https://github.com/nodemcu/nodemcu-firmware/releases/tag/0.9.6-dev_20150331 or newer.

Reply to this email directly or view it on GitHub https://github.com/dvv/nodemcu-thingies/issues/1#issuecomment-99810796.

dvv commented 9 years ago

Wonder if they did the same to socket writer?

On Thu, May 7, 2015 at 4:34 PM, Vladimir Dronnikov dronnikov@gmail.com wrote:

Thanks!

On Thu, May 7, 2015 at 1:45 PM, Marcel Stör notifications@github.com wrote:

With nodemcu/nodemcu-firmware@32e062f https://github.com/nodemcu/nodemcu-firmware/commit/32e062f52333541d27ab44c105b81b92baa24c5e MQTT queueing landed in the firmware. It's available in release 0.9.6-dev_20150331 https://github.com/nodemcu/nodemcu-firmware/releases/tag/0.9.6-dev_20150331 or newer.

Reply to this email directly or view it on GitHub https://github.com/dvv/nodemcu-thingies/issues/1#issuecomment-99810796.

dvv commented 8 years ago

mqtt-queue-helper.lua left for reference