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
#22
(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
  }


Messages In This Thread
RE: [PRE-RELEASE 1] LogicMachine firmware 2019.10 - by DGrandes - 25.11.2019, 09:05

Forum Jump: