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 whether you accept or reject these cookies being set.

Translate 2byte hex values to 14byte string
#1
Hello everyone,

I am looking a way to translate the right column's data (2byte DPT 7) of the attached file to 14byte DPT 16 ASCII characters string in order to get the Daikin error code from the coolmaster and show it on the visualization. I was thinking a code to do something like 'if value (2byte)=0X10 then write a string with the corresponding error characters from daikin A0. There is no need to send this into the KNX so if there is any other way to do it it's ok for me. Any help with a code example is welcomed. 

Thanks in advance


Attached Files
.pdf   Daikin - CoolAutomation Wiki.pdf (Size: 216.95 KB / Downloads: 8)
Reply
#2
You can create a table to map hexadecimal error code to text, then attach it to error code object. You should use 250-byte text data type for status output (32/1/3 in this example).

Code:
errors = {
  [0x10] = 'External protection device activated',
  [0x11] = 'Malfunction of indoor unit PCB',
  [0x13] = 'Drain Level Control System Abnormality',
  [0x14] = 'Malfunction of freezing protection',
  [0x15] = 'High pressure control in heating, freeze-up protection control in cooling',
}

value = event.getvalue()
errtext = errors[ value ]

if errtext then
  grp.update('32/1/3', errtext)
end
Reply
#3
(14.02.2019, 10:54)admin Wrote: You can create a table to map hexadecimal error code to text, then attach it to error code object. You should use 250-byte text data type for status output (32/1/3 in this example).

Code:
errors = {
 [0x10] = 'External protection device activated',
 [0x11] = 'Malfunction of indoor unit PCB',
 [0x13] = 'Drain Level Control System Abnormality',
 [0x14] = 'Malfunction of freezing protection',
 [0x15] = 'High pressure control in heating, freeze-up protection control in cooling',
}

value = event.getvalue()
errtext = errors[ value ]

if errtext then
 grp.update('32/1/3', errtext)
end

Perfect. Thank you admin. Smile
Reply
#4
Hello Admin,

I have a small problem with this solution. The data type indicating the error code is 2byte unsigned value. When I am reading the error code via ETS - KNX Group monitor I am getting a value 29 00 for exmple and the error cannot be translated. If then I manually write the value 00 29 then it works fine. Is there a way to check the 1st byte instead of the 2nd so that the maping table then can correctly translate the error code to a 250byte string?

Thank you
Reply
#5
You can specify table keys as two byte values. For example 0x2900

Or you can get one byte like this:
Code:
value = event.getvalue()
value = bit.rshift(value, 8)
errtext = errors[ value ]
Reply


Forum Jump: