ansible4ozw 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. data/lib/ansible.rb +47 -0
  2. data/lib/ansible/ansible_callback.rb +142 -0
  3. data/lib/ansible/ansible_device.rb +68 -0
  4. data/lib/ansible/ansible_value.rb +179 -0
  5. data/lib/ansible/config.rb +92 -0
  6. data/lib/ansible/devices/ansible_dimmer.rb +80 -0
  7. data/lib/ansible/devices/ansible_switch.rb +66 -0
  8. data/lib/ansible/knx/EIBConnection.rb +2371 -0
  9. data/lib/ansible/knx/dpt/canonical_1bit.rb +54 -0
  10. data/lib/ansible/knx/dpt/dpt1.rb +224 -0
  11. data/lib/ansible/knx/dpt/dpt10.rb +85 -0
  12. data/lib/ansible/knx/dpt/dpt11.rb +72 -0
  13. data/lib/ansible/knx/dpt/dpt12.rb +61 -0
  14. data/lib/ansible/knx/dpt/dpt13.rb +100 -0
  15. data/lib/ansible/knx/dpt/dpt14.rb +87 -0
  16. data/lib/ansible/knx/dpt/dpt15.rb +72 -0
  17. data/lib/ansible/knx/dpt/dpt16.rb +67 -0
  18. data/lib/ansible/knx/dpt/dpt17.rb +65 -0
  19. data/lib/ansible/knx/dpt/dpt18.rb +66 -0
  20. data/lib/ansible/knx/dpt/dpt19.rb +100 -0
  21. data/lib/ansible/knx/dpt/dpt2.rb +156 -0
  22. data/lib/ansible/knx/dpt/dpt3.rb +104 -0
  23. data/lib/ansible/knx/dpt/dpt4.rb +75 -0
  24. data/lib/ansible/knx/dpt/dpt5.rb +124 -0
  25. data/lib/ansible/knx/dpt/dpt6.rb +73 -0
  26. data/lib/ansible/knx/dpt/dpt7.rb +146 -0
  27. data/lib/ansible/knx/dpt/dpt8.rb +118 -0
  28. data/lib/ansible/knx/dpt/dpt9.rb +204 -0
  29. data/lib/ansible/knx/dpt/tests/test_dpt10.rb +45 -0
  30. data/lib/ansible/knx/dpt/tests/test_dpt9.rb +60 -0
  31. data/lib/ansible/knx/hexdump.rb +113 -0
  32. data/lib/ansible/knx/knx_dpt.rb +58 -0
  33. data/lib/ansible/knx/knx_dpt_scalar.rb +62 -0
  34. data/lib/ansible/knx/knx_eistypes.rb +76 -0
  35. data/lib/ansible/knx/knx_protocol.rb +99 -0
  36. data/lib/ansible/knx/knx_scene.rb +48 -0
  37. data/lib/ansible/knx/knx_tools.rb +76 -0
  38. data/lib/ansible/knx/knx_transceiver.rb +237 -0
  39. data/lib/ansible/knx/knx_value.rb +327 -0
  40. data/lib/ansible/openzwave/ozw_constants.rb +11 -0
  41. data/lib/ansible/openzwave/ozw_headers.rb +80 -0
  42. data/lib/ansible/openzwave/ozw_remote_manager.rb +7615 -0
  43. data/lib/ansible/openzwave/ozw_types.rb +406 -0
  44. data/lib/ansible/orbiter_proxy.rb +12 -0
  45. data/lib/ansible/transceiver.rb +63 -0
  46. data/lib/ansible/zwave/types/valuetype_bool.rb +74 -0
  47. data/lib/ansible/zwave/types/valuetype_button.rb +63 -0
  48. data/lib/ansible/zwave/types/valuetype_byte.rb +78 -0
  49. data/lib/ansible/zwave/types/valuetype_decimal.rb +64 -0
  50. data/lib/ansible/zwave/types/valuetype_int.rb +63 -0
  51. data/lib/ansible/zwave/types/valuetype_list.rb +64 -0
  52. data/lib/ansible/zwave/types/valuetype_short.rb +63 -0
  53. data/lib/ansible/zwave/types/valuetype_string.rb +61 -0
  54. data/lib/ansible/zwave/zwave_command_classes.rb +113 -0
  55. data/lib/ansible/zwave/zwave_node.rb +5 -0
  56. data/lib/ansible/zwave/zwave_protocol.rb +52 -0
  57. data/lib/ansible/zwave/zwave_transceiver.rb +435 -0
  58. data/lib/ansible/zwave/zwave_value.rb +193 -0
  59. metadata +108 -0
@@ -0,0 +1,54 @@
1
+ =begin
2
+ Project Ansible - An extensible home automation scripting framework
3
+ ----------------------------------------------------
4
+ Copyright (c) 2011 Elias Karakoulakis <elias.karakoulakis@gmail.com>
5
+
6
+ SOFTWARE NOTICE AND LICENSE
7
+
8
+ Project Ansible is free software: you can redistribute it and/or modify
9
+ it under the terms of the GNU Lesser General Public License as published
10
+ by the Free Software Foundation, either version 3 of the License,
11
+ or (at your option) any later version.
12
+
13
+ Project Ansible is distributed in the hope that it will be useful,
14
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ GNU Lesser General Public License for more details.
17
+
18
+ You should have received a copy of the GNU Lesser General Public License
19
+ along with Project Ansible. If not, see <http://www.gnu.org/licenses/>.
20
+
21
+ for more information on the LGPL, see:
22
+ http://en.wikipedia.org/wiki/GNU_Lesser_General_Public_License
23
+ =end
24
+
25
+
26
+ module Ansible
27
+
28
+ module KNX
29
+
30
+ #
31
+ # 1-bit canonical values for KNX
32
+ # implements value casting to/from the canonical type, a boolean value
33
+ module Canonical_1bit
34
+
35
+ # DPT1 canonical values
36
+ # ---------------------
37
+ # Use Ruby convention for booleans in order to convert
38
+ # input value of (nil, false) into 0, otherwise 1
39
+
40
+ # data is 1 ==> true, false otherwise
41
+ def as_canonical_value()
42
+ return (current_value.data.eql?1)
43
+ end
44
+
45
+ # v is true? 1 : 0
46
+ def to_protocol_value(v)
47
+ return (v ? 1 : 0)
48
+ end
49
+
50
+ end
51
+
52
+ end
53
+
54
+ end
@@ -0,0 +1,224 @@
1
+ =begin
2
+ Project Ansible - An extensible home automation scripting framework
3
+ ----------------------------------------------------
4
+ Copyright (c) 2011 Elias Karakoulakis <elias.karakoulakis@gmail.com>
5
+
6
+ SOFTWARE NOTICE AND LICENSE
7
+
8
+ Project Ansible is free software: you can redistribute it and/or modify
9
+ it under the terms of the GNU Lesser General Public License as published
10
+ by the Free Software Foundation, either version 3 of the License,
11
+ or (at your option) any later version.
12
+
13
+ Project Ansible is distributed in the hope that it will be useful,
14
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ GNU Lesser General Public License for more details.
17
+
18
+ You should have received a copy of the GNU Lesser General Public License
19
+ along with Project Ansible. If not, see <http://www.gnu.org/licenses/>.
20
+
21
+ for more information on the LGPL, see:
22
+ http://en.wikipedia.org/wiki/GNU_Lesser_General_Public_License
23
+ =end
24
+
25
+ require 'knx/dpt/canonical_1bit'
26
+
27
+ module Ansible
28
+
29
+ module KNX
30
+
31
+ #
32
+ # DPT1: 1-bit (boolean) value
33
+ #
34
+ module DPT1
35
+
36
+ # DPT1 frame description.
37
+ # Always 8-bit aligned.
38
+ class DPT1_Frame < DPTFrame
39
+ bit2 :apci_pad, :display_name => "APCI info (not useful)"
40
+ bit5 :null_pad
41
+ bit1 :data, :display_name => "6 bit of useful data"
42
+ end
43
+
44
+ include Canonical_1bit
45
+
46
+ # DPT basetype info hash
47
+ Basetype = {
48
+ :bitlength => 1,
49
+ :range => 0..1,
50
+ :valuetype => :basic,
51
+ :desc => "1-bit value"
52
+ }
53
+
54
+ # DPT subtypes info hash
55
+ Subtypes = {
56
+ # 1.001 on/off
57
+ "001" => { :use => "G",
58
+ :name => "DPT_Switch",
59
+ :desc => "switch",
60
+ :enc => { 0 => "Off", 1 => "On" }
61
+ },
62
+
63
+ # 1.002 boolean
64
+ "002" => { :use => "G",
65
+ :name => "DPT_Bool",
66
+ :desc => "bool",
67
+ :enc => { 0 => "false", 1 => "true" }
68
+ },
69
+
70
+ # 1.003 enable
71
+ "003" => { :use => "G",
72
+ :name => "DPT_Enable",
73
+ :desc => "enable",
74
+ :enc => { 0 => "disable", 1 => "enable" }
75
+ },
76
+
77
+ # 1.004 ramp
78
+ "004" => { :use => "FB",
79
+ :name => "DPT_Ramp",
80
+ :desc => "ramp",
81
+ :enc => { 0 => "No ramp", 1 => "Ramp" }
82
+ },
83
+
84
+ # 1.005 alarm
85
+ "005" => { :use => "FB",
86
+ :name => "DPT_Alarm",
87
+ :desc => "alarm",
88
+ :enc => { 0 => "No alarm", 1 => "Alarm" }
89
+ },
90
+
91
+ # 1.006 binary value
92
+ "006" => { :use => "FB",
93
+ :name => "DPT_BinaryValue",
94
+ :desc => "binary value",
95
+ :enc => { 0 => "Low", 1 => "High" }
96
+ },
97
+
98
+ # 1.007 step
99
+ "007" => { :use => "FB",
100
+ :name => "DPT_Step",
101
+ :desc => "step",
102
+ :enc => { 0 => "Decrease", 1 => "Increase" }
103
+ },
104
+
105
+ # 1.008 up/down
106
+ "008" => { :use => "G",
107
+ :name => "DPT_UpDown",
108
+ :desc => "up/down",
109
+ :enc => { 0 => "Up", 1 => "Down" }
110
+ },
111
+
112
+ # 1.009 open/close
113
+ "009" => { :use => "G",
114
+ :name => "DPT_OpenClose",
115
+ :desc => "open/close",
116
+ :enc => { 0 => "Open", 1 => "Close" }
117
+ },
118
+
119
+ # 1.010 start/stop
120
+ "010" => { :use => "G",
121
+ :name => "DPT_Start",
122
+ :desc => "start/stop",
123
+ :enc => { 0 => "Stop", 1 => "Start" }
124
+ },
125
+
126
+ # 1.011 state
127
+ "011" => { :use => "FB",
128
+ :name => "DPT_State",
129
+ :desc => "state",
130
+ :enc => { 0 => "Inactive", 1 => "Active" }
131
+ },
132
+
133
+ # 1.012 invert
134
+ "012" => { :use => "FB",
135
+ :name => "DPT_Invert",
136
+ :desc => "invert",
137
+ :enc => { 0 => "Not inverted", 1 => "inverted" }
138
+ },
139
+
140
+ # 1.013 dim send style
141
+ "013" => { :use => "FB",
142
+ :name => "DPT_DimSendStyle",
143
+ :desc => "dim send style",
144
+ :enc => { 0 => "Start/stop", 1 => "Cyclically" }
145
+ },
146
+
147
+ # 1.014 input source
148
+ "014" => { :use => "FB",
149
+ :name => "DPT_InputSource",
150
+ :desc => "input source",
151
+ :enc => { 0 => "Fixed", 1 => "Calculated" }
152
+ },
153
+
154
+ # 1.015 reset
155
+ "015" => { :use => "G",
156
+ :name => "DPT_Reset",
157
+ :desc => "reset",
158
+ :enc => { 0 => "no action(dummy)", 1 => "reset command(trigger)" }
159
+ },
160
+
161
+ # 1.016 acknowledge
162
+ "016" => { :use => "G",
163
+ :name => "DPT_Ack",
164
+ :desc => "ack",
165
+ :enc => { 0 => "no action(dummy)", 1 => "acknowledge command(trigger)" }
166
+ },
167
+
168
+ # 1.017 trigger
169
+ "017" => { :use => "G",
170
+ :name => "DPT_Trigger",
171
+ :desc => "trigger",
172
+ :enc => { 0 => "trigger", 1 => "trigger" }
173
+ },
174
+
175
+ # 1.018 occupied
176
+ "018" => { :use => "G",
177
+ :name => "DPT_Occupancy",
178
+ :desc => "occupancy",
179
+ :enc => { 0 => "not occupied", 1 => "occupied" }
180
+ },
181
+
182
+ # 1.019 open window or door
183
+ "019" => { :use => "G",
184
+ :name => "DPT_WindowDoor",
185
+ :desc => "open window/door",
186
+ :enc => { 0 => "closed", 1 => "open" }
187
+ },
188
+
189
+ # 1.021 and/or
190
+ "021" => { :use => "FB",
191
+ :name => "DPT_LogicalFunction",
192
+ :desc => "and/or",
193
+ :enc => { 0 => "logical function OR", 1 => "logical function AND" }
194
+ },
195
+
196
+ # 1.022 scene A/B
197
+ "022" => { :use => "FB",
198
+ :name => "DPT_Scene_AB",
199
+ :desc => "scene A/B",
200
+ :enc => { 0 => "scene A", 1 => "scene B" }
201
+ },
202
+
203
+ # 1.023 shutter/blinds mode
204
+ "023" => { :use => "FB",
205
+ :name => "DPT_ShutterBlinds_Mode",
206
+ :desc => "shutter/blinds mode",
207
+ :enc => { 0 => "only move Up/Down mode (shutter)", 1 => "move Up/Down + StepStop mode (blind)" }
208
+ },
209
+
210
+ # 1.100 cooling/heating ---FIXME---
211
+ "100" => { :use => "???",
212
+ :name => "DPT_Heat/Cool",
213
+ :desc => "heat/cool",
214
+ :enc => { 0 => "???", 1 => "???" }
215
+ },
216
+ }
217
+
218
+ include Canonical_1bit
219
+
220
+ end #module DPT1
221
+
222
+ end
223
+
224
+ end
@@ -0,0 +1,85 @@
1
+ =begin
2
+ Project Ansible - An extensible home automation scripting framework
3
+ ----------------------------------------------------
4
+ Copyright (c) 2011 Elias Karakoulakis <elias.karakoulakis@gmail.com>
5
+
6
+ SOFTWARE NOTICE AND LICENSE
7
+
8
+ Project Ansible is free software: you can redistribute it and/or modify
9
+ it under the terms of the GNU Lesser General Public License as published
10
+ by the Free Software Foundation, either version 3 of the License,
11
+ or (at your option) any later version.
12
+
13
+ Project Ansible is distributed in the hope that it will be useful,
14
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ GNU Lesser General Public License for more details.
17
+
18
+ You should have received a copy of the GNU Lesser General Public License
19
+ along with Project Ansible. If not, see <http://www.gnu.org/licenses/>.
20
+
21
+ for more information on the LGPL, see:
22
+ http://en.wikipedia.org/wiki/GNU_Lesser_General_Public_License
23
+ =end
24
+
25
+ module Ansible
26
+
27
+ module KNX
28
+
29
+ #
30
+ # DPT10.*: time
31
+ #
32
+ module DPT10
33
+
34
+ # DPTFrame to parse a DPT10 frame.
35
+ # Always 8-bit aligned.
36
+ class DPT10_Frame < DPTFrame
37
+ bit3 :dayofweek, {
38
+ :display_name => "Day of week",
39
+ :range => 0..7,
40
+ :enc => {
41
+ 0 => "(no day set)",
42
+ 1 => "Monday",
43
+ 2 => "Tuesday",
44
+ 3 => "Wednesday",
45
+ 4 => "Thursday",
46
+ 5 => "Friday",
47
+ 6 => "Saturday",
48
+ 7 => "Sunday"
49
+ }
50
+ }
51
+ bit5 :hour, {
52
+ :display_name => "Hour", :range => 0..23
53
+ }
54
+ #
55
+ bit2 :pad2
56
+ bit6 :minutes, {
57
+ :display_name => "Minutes", :range => 0..59
58
+ }
59
+ #
60
+ bit2 :pad3
61
+ bit6 :seconds, {
62
+ :display_name => "Seconds", :range => 0..59
63
+ }
64
+ end
65
+
66
+ # DPT10 base type info
67
+ Basetype = {
68
+ :bitlength => 24,
69
+ :valuetype => :composite,
70
+ :desc => "day of week + time of day"
71
+ }
72
+
73
+ # DPT10 subtypes info
74
+ Subtypes = {
75
+ # 10.001 time of day
76
+ "001" => {
77
+ :name => "DPT_TimeOfDay", :desc => "time of day"
78
+ }
79
+ }
80
+
81
+ end
82
+
83
+ end
84
+
85
+ end
@@ -0,0 +1,72 @@
1
+ =begin
2
+ Project Ansible - An extensible home automation scripting framework
3
+ ----------------------------------------------------
4
+ Copyright (c) 2011 Elias Karakoulakis <elias.karakoulakis@gmail.com>
5
+
6
+ SOFTWARE NOTICE AND LICENSE
7
+
8
+ Project Ansible is free software: you can redistribute it and/or modify
9
+ it under the terms of the GNU Lesser General Public License as published
10
+ by the Free Software Foundation, either version 3 of the License,
11
+ or (at your option) any later version.
12
+
13
+ Project Ansible is distributed in the hope that it will be useful,
14
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ GNU Lesser General Public License for more details.
17
+
18
+ You should have received a copy of the GNU Lesser General Public License
19
+ along with Project Ansible. If not, see <http://www.gnu.org/licenses/>.
20
+
21
+ for more information on the LGPL, see:
22
+ http://en.wikipedia.org/wiki/GNU_Lesser_General_Public_License
23
+ =end
24
+
25
+ module Ansible
26
+
27
+ module KNX
28
+
29
+ #
30
+ # DPT11.*: date
31
+ #
32
+ module DPT11
33
+
34
+ class DPT11_Frame < DPTFrame
35
+ bit3 :pad1
36
+ bit5 :dayofmonth, {
37
+ :display_name => "Day of month (1..31)", :range => 1..31
38
+ }
39
+ #
40
+ bit4 :pad2
41
+ bit4 :month, {
42
+ :display_name => "Month (1..12)", :range => 1..12
43
+ }
44
+ #
45
+ bit1 :pad3
46
+ bit7 :year, {
47
+ :display_name => "Year 0..99 (<90 => 20xx, >=90 => 19xx)", :range => 0..99
48
+ }
49
+ end
50
+
51
+ # DPT11 base type info
52
+ Basetype = {
53
+ :bitlength => 24,
54
+ :valuetype => :composite,
55
+ :desc => "3-byte date value"
56
+ }
57
+
58
+
59
+ # DPT11 subtypes info
60
+ Subtypes = {
61
+ # 11.001 date
62
+ "001" => {
63
+ :name => "DPT_Date", :desc => "Date"
64
+ }
65
+ }
66
+
67
+ end
68
+
69
+ end
70
+
71
+ end
72
+
@@ -0,0 +1,61 @@
1
+ =begin
2
+ Project Ansible - An extensible home automation scripting framework
3
+ ----------------------------------------------------
4
+ Copyright (c) 2011 Elias Karakoulakis <elias.karakoulakis@gmail.com>
5
+
6
+ SOFTWARE NOTICE AND LICENSE
7
+
8
+ Project Ansible is free software: you can redistribute it and/or modify
9
+ it under the terms of the GNU Lesser General Public License as published
10
+ by the Free Software Foundation, either version 3 of the License,
11
+ or (at your option) any later version.
12
+
13
+ Project Ansible is distributed in the hope that it will be useful,
14
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ GNU Lesser General Public License for more details.
17
+
18
+ You should have received a copy of the GNU Lesser General Public License
19
+ along with Project Ansible. If not, see <http://www.gnu.org/licenses/>.
20
+
21
+ for more information on the LGPL, see:
22
+ http://en.wikipedia.org/wiki/GNU_Lesser_General_Public_License
23
+ =end
24
+
25
+ module Ansible
26
+
27
+ module KNX
28
+
29
+ #
30
+ # DPT12.*: 4-byte unsigned value
31
+ #
32
+ module DPT12
33
+
34
+ class DPT12_Frame < DPTFrame
35
+ uint32 :data, {
36
+ :display_name => "32-bit value",
37
+ :range => 0..2**32-1
38
+ }
39
+ end
40
+
41
+ # DPT12 base type info
42
+ Basetype = {
43
+ :bitlength => 32,
44
+ :valuetype => :basic,
45
+ :desc => "4-byte unsigned value"
46
+ }
47
+
48
+ # DPT12 subtype info
49
+ Subtypes = {
50
+ # 12.001 counter pulses
51
+ "001" => {
52
+ :name => "DPT_Value_4_Ucount", :desc => "counter pulses"
53
+ }
54
+ }
55
+
56
+ end
57
+
58
+ end
59
+
60
+ end
61
+