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.

Modbus profiles examples
#73
Hi, small script, which will help to create json profile for daikin modbus interface DIII (D3)
Code:
require('json')
data = {
  manufacturer = "daikin",
  description = "modbus gateway",
  mapping = {
    {
      }
    }
  }



str = json.encode(data)
--log(str)
--io.writefile('home/ftp/modbus.json', str)
ac_zones = {
  [1] ={
    [0] = '2_15 Мастер спальня',
    [1] = '2_01 Прихожая',
    [2] = '2_07 Cпальня 2',
    [3] = '2_02 Cпальня 1'   
    },
  [2] ={
    [0] = '1_18 Каминная',
    [1] = '1_16 Холл 2',
    [2] = '1_09 Массажная',
    [3] = '1_08 Спортзал',
    [4] = '1_04 Гостиная',
    [5] = '1_05 кухн'   
    },
  [3] ={
    [0] = '0_06-1 Бар',
    [1] = '0_06-2 Бар',
    [2] = '0_03 ДК'   
    },
  }
function ac_mapping_create (zones_table)
  mapping_table = {}
  for line, zones in pairs(zones_table) do
    for unit, name in pairs(zones) do
      -- статус подключения
      table.insert(mapping_table,
        {
          name = name.." - connection",
          type = "inputregister",
          bus_datatype = "bool",
          address = 1 + (line-1),
          datatype =  "int16",
          value_bitmask = 2^(unit)
          }
        )
      -- ошибка коммуникации
      table.insert(mapping_table,
        {
          name = name.." - communication error",
          type = "inputregister",
          bus_datatype = "bool",
          address = 5 + (line-1),
          datatype =  "int16",
          value_bitmask = 2^(unit)
          }
        )
      -- уставка
      table.insert(mapping_table,
        {
          name = name.." - setpoint ctrl",
          type = "register",
          bus_datatype = "temperature",
          address = 2002 + (line-1)*16*3 + unit*3,
          datatype =  "int16",
          writable = 1,
            write_only = 1,
          value_multiplier = 0.1
          }
        )
        table.insert(mapping_table,
        {
          name = name.." - setpoint status",
          type = "inputregister",
          bus_datatype = "temperature",
          address = 2002 + (line-1)*16*6 + unit*6,
          datatype =  "int16",
          value_multiplier = 0.1
          }
        )
      -- текущая
      table.insert(mapping_table,
          {
          name =  name.." - Room temp",
          type = "inputregister",
          bus_datatype = "temperature",
          address = 2004 + (line-1)*16*6 + unit*6,
          datatype = "int16",
          value_multiplier = 0.1
        }
        )
      -- opermode
      table.insert(mapping_table,
          {
          name =  name.." - Operation mode status",
          type = "inputregister",
          bus_datatype = "uint8",
          address = 2001 + (line-1)*16*6 + unit*6,
          datatype = "int16",
          value_bitmask = 15
        }
        )
      table.insert(mapping_table,
        {
          name = name.." - Operation mode ctrl",
          type = "register",
          bus_datatype = "uint8",
          address = 2001 + (line-1)*16*3 + unit*3,
          datatype =  "int16",
          writable = 1,
            write_only = 1,
          value_bitmask = 15,
          write_bitmask = true
          }
        )
      --fan st
      table.insert(mapping_table,
          {
          name =  name.." - fan speed status",
          type = "inputregister",
          bus_datatype = "uint8",
          address = 2000 + (line-1)*16*6 + unit*6,
          datatype = "int16",
          value_bitmask = 28672
        }
        )
      table.insert(mapping_table,
          {
          name =  name.." - fan status",
          type = "inputregister",
          bus_datatype = "uint8",
          address = 2000 + (line-1)*16*6 + unit*6,
          datatype = "int16",
          value_bitmask = 32
        }
        )
      -- power st
      table.insert(mapping_table,
          {
          name =  name.." - onoff status",
          type = "inputregister",
          bus_datatype = "uint8",
          address = 2000 + (line-1)*16*6 + unit*6,
          datatype = "int16",
          value_bitmask = 1
        }
        )
      -- controls
      table.insert(mapping_table,
        {
          name = name.." - fan speed ctrl",
          type = "register",
          bus_datatype = "uint8",
          address = 2000 + (line-1)*16*3 + unit*3,
          datatype =  "int16",
          writable = 1,
            write_only = 1,
          value_bitmask = 28672,
          write_bitmask = true
          }
        )
      table.insert(mapping_table,
        {
          name = name.." - fan flag ctrl",
          type = "register",
          bus_datatype = "uint8",
          address = 2000 + (line-1)*16*3 + unit*3,
          datatype =  "int16",
          writable = 1,
            write_only = 1,
          value_bitmask = 240,
          write_bitmask = true
          }
        )
      table.insert(mapping_table,
        {
          name = name.." - onoff ctrl",
          type = "register",
          bus_datatype = "bool",
          address = 2000 + (line-1)*16*3 + unit*3,
          datatype =  "int16",
          writable = 1,
            write_only = 1,
          value_bitmask = 1,
          write_bitmask = true
          }
        )
      end
    end
  return mapping_table
  end
data.mapping = ac_mapping_create(ac_zones)

str = json.encode(data)
log(io.writefile('home/ftp/KP1_DAIKIN_modbus.json', str))
just fill the ac_zones table according to your room names
ac_zones[i][j]
i - line(1-4)
j - ac unit (00-15)

and then download profile fromlocal ftp server using "ftp" login. you can add more registers if it is needed

Attached Files
Reply


Messages In This Thread
Modbus profiles examples - by AEK - 15.06.2017, 07:43
RE: Modbus profiles examples - by morak - 15.06.2017, 10:59
Modbus profiles examples - by ELO - 17.10.2017, 05:29
RE: Modbus profiles examples - by admin - 21.10.2017, 06:05
RE: Modbus profiles examples - by Gadjoken - 23.10.2017, 08:53
RE: Modbus profiles examples - by thientiti01 - 24.11.2017, 07:52
RE: Modbus profiles examples - by AEK - 27.11.2017, 09:18
RE: Modbus profiles examples - by thientiti01 - 27.11.2017, 10:25
RE: Modbus profiles examples - by jetsetter - 30.11.2017, 12:22
RE: Modbus profiles examples - by admin - 30.11.2017, 12:36
RE: Modbus profiles examples - by m.j.sorokin - 30.11.2017, 17:29
RE: Modbus profiles examples - by jmir - 04.12.2017, 14:19
RE: Modbus profiles examples - by FatMax - 05.12.2017, 22:53
RE: Modbus profiles examples - by admin - 06.12.2017, 07:01
RE: Modbus profiles examples - by FatMax - 08.12.2017, 09:06
RE: Modbus profiles examples - by Kaveckiy - 13.09.2018, 06:24
RE: Modbus profiles examples - by fiLLLip - 03.01.2019, 05:52
RE: Modbus profiles examples - by Daniel - 08.03.2019, 11:35
RE: Modbus profiles examples - by AlexLV - 10.03.2019, 15:12
RE: Modbus profiles examples - by admin - 11.03.2019, 07:35
RE: Modbus profiles examples - by AlexLV - 11.03.2019, 11:47
RE: Modbus profiles examples - by Rick - 19.10.2020, 09:53
RE: Modbus profiles examples - by Daniel - 19.10.2020, 09:59
RE: Modbus profiles examples - by Rick - 19.10.2020, 10:16
RE: Modbus profiles examples - by stavros - 29.10.2020, 14:13
RE: Modbus profiles examples - by admin - 29.10.2020, 14:25
RE: Modbus profiles examples - by stavros - 30.10.2020, 10:38
RE: Modbus profiles examples - by stemic01 - 04.11.2020, 20:56
RE: Modbus profiles examples - by AnLi_HOUSE - 11.11.2020, 18:33
RE: Modbus profiles examples - by victor.back - 20.11.2020, 18:34
RE: Modbus profiles examples - by epps - 18.07.2021, 15:05
RE: Modbus profiles examples - by epps - 18.07.2021, 18:21
RE: Modbus profiles examples - by lasttrip - 06.08.2021, 06:14
RE: Modbus profiles examples - by admin - 06.08.2021, 08:14
RE: Modbus profiles examples - by edgars - 26.08.2021, 08:22
RE: Modbus profiles examples - by Daniel - 18.10.2021, 13:47
RE: Modbus profiles examples - by tthamm - 08.01.2022, 07:31
RE: Modbus profiles examples - by admin - 10.01.2022, 08:07
RE: Modbus profiles examples - by tthamm - 23.01.2022, 17:27
RE: Modbus profiles examples - by admin - 24.01.2022, 07:14
RE: Modbus profiles examples - by tthamm - 02.10.2022, 10:48
RE: Modbus profiles examples - by Dré - 04.10.2022, 15:09
RE: Modbus profiles examples - by gtsamis - 28.01.2022, 18:05
RE: Modbus profiles examples - by Daniel - 31.01.2022, 08:41
RE: Modbus profiles examples - by gtsamis - 31.01.2022, 08:48
RE: Modbus profiles examples - by Ian@GWTi - 21.03.2022, 11:10
RE: Modbus profiles examples - by jmir - 23.03.2022, 13:43
RE: Modbus profiles examples - by admin - 23.03.2022, 14:41
RE: Modbus profiles examples - by jmir - 23.03.2022, 15:05
RE: Modbus profiles examples - by khalil - 15.06.2022, 14:11
RE: Modbus profiles examples - by Daniel - 15.06.2022, 14:42
RE: Modbus profiles examples - by admin - 16.06.2022, 07:12
RE: Modbus profiles examples - by khalil - 16.06.2022, 13:59
RE: Modbus profiles examples - by Ian@GWTi - 22.07.2022, 14:27
RE: Modbus profiles examples - by admin - 26.07.2022, 06:23
RE: Modbus profiles examples - by Daniel - 03.10.2022, 07:54
RE: Modbus profiles examples - by tthamm - 03.10.2022, 18:04
RE: Modbus profiles examples - by Daniel - 04.10.2022, 07:39
Modbus profiles examples - by fabiorusco - 27.12.2022, 14:48
RE: Modbus profiles examples - by fabiorusco - 28.12.2022, 07:01
RE: Modbus profiles examples - by admin - 28.12.2022, 07:30
RE: Modbus profiles examples - by fabiorusco - 28.12.2022, 08:32
RE: Modbus profiles examples - by pritorianz - 10.03.2023, 10:12
LG AWHP Modbus RTU Profile - by KoBra - 08.04.2023, 13:16
RE: Modbus profiles examples - by AEK - 25.09.2023, 19:11
RE: Modbus profiles examples - by fabiorusco - 30.09.2023, 09:57
RE: Modbus profiles examples - by tomnord - 30.09.2023, 15:25
NIBE S1155 Modbus profile - by merel - 25.01.2024, 09:46
RE: Modbus profiles examples - by Tuwat47 - 16.07.2024, 08:02
RE: Modbus profiles examples - by epps - 23.09.2024, 07:42
RE: Modbus profiles examples - by Novodk - Yesterday, 13:31
Huawey Modbus TCP json - by CristianAgata - 06.10.2024, 13:02
RE: Modbus profiles examples - by Tuwat47 - 25.10.2024, 06:48

Forum Jump: