01.07.2019, 12:52 (This post was last modified: 01.07.2019, 13:51 by Thomas.)
Hello
I've a water gauge which returns pulses.
I want to show water consumption for the last 1 hour.
Do you have any idea how to do it in LM way?
If no is this correct hack?
01.07.2019, 14:02 (This post was last modified: 01.07.2019, 14:08 by Thomas.)
Code:
123456
functionecl_get_last_hour_counter(ls_address)
localobj_addressraw = knxlib.encodega(ls_address)
localquery = "select count() as pulses_per_hour FROM objectlog WHERE datahex='01' AND objectlog.address="..obj_addressraw.." AND logtime>="..tostring(os.microtime()-3600)
localcount = db:getall(query)
returncount[1].pulses_per_hourend
LM5Lp, firmware: 2018.08.22 and 2021.12.15, FlashSYS v2, ARMv7 Processor rev 5 (v7l), kernel 4.4.151 and 4.4.259
(01.07.2019, 16:06)admin Wrote: You can use db:getone to get value of the first column of the first row.
Thank you. Are there descriptions of these libraries somewhere? Maybe I'm overlooking something but it's always hard to me to use your libraries because of lack of documentation.
LM5Lp, firmware: 2018.08.22 and 2021.12.15, FlashSYS v2, ARMv7 Processor rev 5 (v7l), kernel 4.4.151 and 4.4.259
There's no public documentation for this since most users don't need to access database directly. You can find function description here: http://openrb.com/docs/db.htm
(02.07.2019, 12:41)admin Wrote: There's no public documentation for this since most users don't need to access database directly. You can find function description here: http://openrb.com/docs/db.htm
Thank you
LM5Lp, firmware: 2018.08.22 and 2021.12.15, FlashSYS v2, ARMv7 Processor rev 5 (v7l), kernel 4.4.151 and 4.4.259