diff options
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 |