(25.11.2019, 07:35)admin Wrote: This means that connection is working fine.
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
Hi,
Don´t log anything when I change value of 37/3/1 and in the script i have:
Code:
object_to_mqtt = {
['37/3/1'] = 'SEND1',
['37/3/2'] = 'SEND2', --SEND 1 and SEND 2 are object to mqtt commands
}