25.11.2019, 07:35
This means that connection is working fine.
Next add some logging to group event callback:
Next add some logging to group event callback:
Code:
function publishvalue(event)
-- message from us or client is not connected
if event.sender == 'mq' or not mclientfd then
return
end
local addr = event.dst
local dpt = datatypes[ addr ]
local topic = object_to_mqtt[ addr ]
-- unknown object
if not dpt or not topic then
return
end
local value = busdatatype.decode(event.datahex, dpt)
if value ~= nil then
if type(value) == 'boolean' then
value = value and 1 or 0
end
log('publish', mclient:publish(topic, tostring(value)) )
else
log('failed to decode data', event.datahex, dpt)
end
end