This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

[OLD] LogicMachine firmware 2019.10
#21
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


Messages In This Thread
RE: [PRE-RELEASE 1] LogicMachine firmware 2019.10 - by admin - 25.11.2019, 07:35

Forum Jump: