diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2015-10-04 16:46:58 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2015-10-04 16:46:58 +0200 |
commit | 5fb5e20aa00ead18785c14fe788cdfdbced14f63 (patch) | |
tree | 414b35d76f065a026157488e49d60b090d0f612b /mqtt-bridge | |
parent | dcba99769089f3ebccf839f4be6c605da52e64d7 (diff) | |
download | esp-playground-5fb5e20aa00ead18785c14fe788cdfdbced14f63.tar.gz esp-playground-5fb5e20aa00ead18785c14fe788cdfdbced14f63.tar.bz2 esp-playground-5fb5e20aa00ead18785c14fe788cdfdbced14f63.tar.xz esp-playground-5fb5e20aa00ead18785c14fe788cdfdbced14f63.zip |
o Better firmware info when posting.
Diffstat (limited to 'mqtt-bridge')
-rw-r--r-- | mqtt-bridge/mq.lua | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/mqtt-bridge/mq.lua b/mqtt-bridge/mq.lua index da77063..a6ae0b9 100644 --- a/mqtt-bridge/mq.lua +++ b/mqtt-bridge/mq.lua @@ -19,8 +19,18 @@ end local function mq_client_connected(con) p("connected") - local majorVer, minorVer, devVer, chipId, flashId, flashSize, flashMode, flashSpeed = node.info() - payload = '{"version": "'..majorVer..'.'..minorVer..'.'..devVer..'", "chipId":'..chipId..', "flashId":'..flashId..', "flashSize":'..flashSize..', "flashMode":'..flashMode..', "flashSpeed":'..flashSpeed.."}" + local majorVer, minorVer, devVer, chipId, flashId, flashSize, flashMode, flashSpeed, buildDate = node.info() + payload = '{"version": "'..majorVer..'.'..minorVer..'.'..devVer..'", "chipId":'..chipId..', "flashId":'..flashId..', "flashSize":'..flashSize..', "flashMode":'..flashMode..', "flashSpeed":'..flashSpeed + + if buildDate then + payload = payload..', "buildDate": "'..buildDate..'"' + end + + if node.info_versions then + major, minor, dev, buildDate, sdkVersion = node.info_versions() + payload = payload..'", versions": {"major": '..major..', "minor": '..minor..', "dev": '..dev..', "buildDate": "'..buildDate..'", "sdk": "'..sdkVersion..'"}' + end + payload = payload.."}" P.publish("firmware", payload) end |