LogicMachine Forum
KNX 19.001 datatype - Printable Version

+- LogicMachine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: KNX 19.001 datatype (/showthread.php?tid=2035)



KNX 19.001 datatype - KristianSl - 19.04.2019

Hi
I`m trying to write time and date to a group adress with datatype 19.001. Have been looking in the example: http://openrb.com/example-write-lm2-datatime-to-knx-group-addresses/
but can`t really see there how I`m supposed to Write the actually value to the Group adress. (I`m really new at this Undecided )

Can you help me?

-Kristian


RE: KNX 19.001 datatype - gtsamis - 19.04.2019

(19.04.2019, 19:58)KristianSl Wrote: Hi
I`m trying to write time and date to a group adress with datatype 19.001. Have been looking in the example: http://openrb.com/example-write-lm2-datatime-to-knx-group-addresses/
but can`t really see there how I`m supposed to Write the actually value to the Group adress. (I`m really new at this Undecided )

Can you help me?

-Kristian

Use the code below and modify as needed

Code:
-- get current data as table now = os.date('*t') -- system week day starts from sunday, convert it to knx format wday = now.wday == 1 and 7 or now.wday - 1 -- time table time = { day = wday, hour = now.hour, minute = now.min, second = now.sec, } -- date table date = { day = now.day, month = now.month, year = now.year, } --- full date bits OCT08 = now.year - 1900 OCT07 = now.month OCT06 = now.day OCT05 = bit.bor(bit.lshift(wday, 5), now.hour) OCT04 = now.min OCT03 = now.sec OCT02 = 0 -- subfields like working day and dst not specified in this sample OCT01 = 0 -- subfields like quality of clock not specified in this sample -- write to bus date_time = string.char(OCT08) .. string.char(OCT07) .. string.char(OCT06) .. string.char(OCT05) .. string.char(OCT04) .. string.char(OCT03)  .. string.char(OCT02)  .. string.char(OCT01) grp.write('Date', date, dt.date) grp.write('Time', time, dt.time) grp.write('DateTime', date_time)



RE: KNX 19.001 datatype - KristianSl - 21.04.2019

(19.04.2019, 21:36)gtsamis Wrote:
(19.04.2019, 19:58)KristianSl Wrote: Hi
I`m trying to write time and date to a group adress with datatype 19.001. Have been looking in the example: http://openrb.com/example-write-lm2-datatime-to-knx-group-addresses/
but can`t really see there how I`m supposed to Write the actually value to the Group adress. (I`m really new at this Undecided )

Can you help me?

-Kristian

Use the code below and modify as needed

Code:
-- get current data as table now = os.date('*t') -- system week day starts from sunday, convert it to knx format wday = now.wday == 1 and 7 or now.wday - 1 -- time table time = { day = wday, hour = now.hour, minute = now.min, second = now.sec, } -- date table date = { day = now.day, month = now.month, year = now.year, } --- full date bits OCT08 = now.year - 1900 OCT07 = now.month OCT06 = now.day OCT05 = bit.bor(bit.lshift(wday, 5), now.hour) OCT04 = now.min OCT03 = now.sec OCT02 = 0 -- subfields like working day and dst not specified in this sample OCT01 = 0 -- subfields like quality of clock not specified in this sample -- write to bus date_time = string.char(OCT08) .. string.char(OCT07) .. string.char(OCT06) .. string.char(OCT05) .. string.char(OCT04) .. string.char(OCT03)  .. string.char(OCT02)  .. string.char(OCT01) grp.write('Date', date, dt.date) grp.write('Time', time, dt.time) grp.write('DateTime', date_time)

Smile thanks


RE: KNX 19.001 datatype - zuuper - 19.12.2019

ello,

It doesn't work for me when I have to write down a datetime (DPT 19.001).

I only get the result:
RawDpValue
00 00 00 00 00 00 00 00

Can anyone try to help me please?

My code is,
function setDateTime(obj)

  -- get current data as table
  now = os.date('*t')

  -- system week day starts from sunday, convert it to knx format
  wday = now.wday == 1 and 7 or now.wday - 1

-- time table
  time = {
  day = wday,
  hour = now.hour,
  minute = now.min,
  second = now.sec,
  }

  -- date table
  date = {
  day = now.day,
  month = now.month,
  year = now.year,
  }

  --- full date bits
  OCT08 = now.year - 1900
  OCT07 = now.month
  OCT06 = now.day
  OCT05 = bit.bor(bit.lshift(wday, 5), now.hour)
  OCT04 = now.min
  OCT03 = now.sec
  OCT02 = 0 -- subfields like working day and dst not specified in this sample
  OCT01 = 0 -- subfields like quality of clock not specified in this sample

 
  log (OCT08,OCT07,OCT06,OCT05,OCT04,OCT03,OCT02,OCT01)

  -- write to bus
  date_time = string.char(OCT08) .. string.char(OCT07) .. string.char(OCT06) .. string.char(OCT05) .. string.char(OCT04) .. string.char(OCT03)  .. string.char(OCT02)  .. string.char(OCT01)
grp.write(obj, date_time)
 
end


RE: KNX 19.001 datatype - Daniel - 19.12.2019

Hi
I used your script without the function and it works.

Code:
  -- get current data as table   now = os.date('*t')   -- system week day starts from sunday, convert it to knx format   wday = now.wday == 1 and 7 or now.wday - 1 -- time table   time = {   day = wday,   hour = now.hour,   minute = now.min,   second = now.sec,   }   -- date table   date = {   day = now.day,   month = now.month,   year = now.year,   }   --- full date bits   OCT08 = now.year - 1900   OCT07 = now.month   OCT06 = now.day   OCT05 = bit.bor(bit.lshift(wday, 5), now.hour)   OCT04 = now.min   OCT03 = now.sec   OCT02 = 0 -- subfields like working day and dst not specified in this sample   OCT01 = 0 -- subfields like quality of clock not specified in this sample   log (OCT08,OCT07,OCT06,OCT05,OCT04,OCT03,OCT02,OCT01)   -- write to bus   date_time = string.char(OCT08) .. string.char(OCT07) .. string.char(OCT06) .. string.char(OCT05) .. string.char(OCT04) .. string.char(OCT03)  .. string.char(OCT02)  .. string.char(OCT01) grp.write('date test2', date_time)



RE: KNX 19.001 datatype - zuuper - 19.12.2019

Can it be a problem because my language-settings Swedish?


RE: KNX 19.001 datatype - admin - 19.12.2019

Try specifying datatype explicitly:
grp.write(obj, date_time, dt.string)


RE: KNX 19.001 datatype - zuuper - 19.12.2019

(19.12.2019, 14:55)admin Wrote: Try specifying datatype explicitly:
grp.write(obj, date_time, dt.string)

When I specify with dt.string, the result been type of
16.001 Character String (ISO 8859-1)

And nothing saves/writes into '2/0/0'

Log:

Loggad vid 19.12.2019 16:18:04
* arg: 1
  * number: 119
* arg: 2
  * number: 12
* arg: 3
  * number: 19
* arg: 4
  * number: 144
* arg: 5
  * number: 18
* arg: 6
  * number: 4
* arg: 7
  * number: 0
* arg: 8
  * number: 0


 




RE: KNX 19.001 datatype - Erwin van der Zwart - 19.12.2019

Hi,

You should use the 250 byte object for this..

BR,

Erwin


RE: KNX 19.001 datatype - zuuper - 19.12.2019

(19.12.2019, 15:34)Erwin van der Zwart Wrote: Hi,

You should use the 250 byte object for this..

BR,

Erwin


Yes, but how?

BR Alex


RE: KNX 19.001 datatype - Daniel - 19.12.2019

(19.12.2019, 15:50)zuuper Wrote:
(19.12.2019, 15:34)Erwin van der Zwart Wrote: Hi,

You should use the 250 byte object for this..

BR,

Erwin


Yes, but how?

BR Alex
The object you writing to must be 250 byte string.  The real values you will see only in ETS group monitor


RE: KNX 19.001 datatype - zuuper - 19.12.2019

(19.12.2019, 15:53)Daniel. Wrote:
(19.12.2019, 15:50)zuuper Wrote:
(19.12.2019, 15:34)Erwin van der Zwart Wrote: Hi,

You should use the 250 byte object for this..

BR,

Erwin


Yes, but how?

BR Alex
The object you writing to must be 250 byte string.  The real values you will see only in ETS group monitor


I trying to write to this:


RE: KNX 19.001 datatype - Daniel - 19.12.2019

Like this, with script I posted


RE: KNX 19.001 datatype - zuuper - 19.12.2019

(19.12.2019, 16:09)Daniel. Wrote: Like this, with script I posted


Thank you SmileSmile
Now its works Smile