-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathKNXhelper.lua
54 lines (42 loc) · 1.41 KB
/
KNXhelper.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
--[[****************************************************************/
/* __/\\\________/\\\____/\\\\\\\\\________/\\\\\\\\\_____ */
/* _\/\\\_____/\\\//___/\\\///////\\\____/\\\///////\\\___ */
/* _\/\\\__/\\\//_____\/\\\_____\/\\\___\///______\//\\\__ */
/* _\/\\\\\\//\\\_____\/\\\\\\\\\\\/______________/\\\/___ */
/* _\/\\\//_\//\\\____\/\\\//////\\\___________/\\\//_____ */
/* _\/\\\____\//\\\___\/\\\____\//\\\_______/\\\//________ */
/* _\/\\\_____\//\\\__\/\\\_____\//\\\____/\\\/___________ */
/* _\/\\\______\//\\\_\/\\\______\//\\\__/\\\\\\\\\\\\\\\_ */
/* _\///________\///__\///________\///__\///////////////__ */
/* */
/****************************************************************--]]
--[[
* @file KNXhelper.lua
* @path -
* @version 1
*
* @date 29.09.2011
* @author KR2
*
* @brief KNX helper functions
*
--]]
module(..., package.seeall)
-- sets output only if value has canged
function setComObj_int(objNr ,bytes ,val)
if knx.get_integer(objNr) ~= val then
knx.set_integer(objNr,bytes,val)
sys.signal_obj(objNr)
end
end
function set_2Bfloat(objNr,val)
temp = val * 100
temp = knx.int_to_dpt9(temp)
setComObj_int(objNr,2,temp)
end
function get_2Bfloat(objNr)
temp = knx.get_integer(objNr)
temp = knx.dpt9_to_int(temp)
temp = (0.0 + temp) / 100
return temp
end