Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 46 lines (36 sloc) 1.619 kb
d545344 a first working version of the state mapper
Elias Karakoulakis authored
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 $:.push(Dir.getwd)
26 $:.push(File.join(Dir.getwd, 'knx'))
27 $:.push(File.join(Dir.getwd, 'zwave'))
28
61b6211 I think I'll default now...
Elias Karakoulakis authored
29 require 'knx_transceiver'
30 require 'knx_tools'
d545344 a first working version of the state mapper
Elias Karakoulakis authored
31
61b6211 I think I'll default now...
Elias Karakoulakis authored
32 require 'config'
33
34 KNX = Ansible::KNX::KNX_Transceiver.new(Ansible::KNX_URL)
d545344 a first working version of the state mapper
Elias Karakoulakis authored
35 # monitor all KNX activity
61b6211 I think I'll default now...
Elias Karakoulakis authored
36 KNX.add_callback(:onKNXtelegram) { | sender, cb, frame |
d545344 a first working version of the state mapper
Elias Karakoulakis authored
37 if frame.dst_addr < 4048 then
38 puts "frame==#{frame.inspect}"
39 puts "data ==#{frame.data}"
40 puts Ansible::KNX::APCICODES[frame.apci] + " packet from " + addr2str(frame.src_addr) + " to " + addr2str(frame.dst_addr, frame.daf) + ", priority=" + Ansible::KNX::PRIOCLASSES[frame.prio_class]\
41 end
61b6211 I think I'll default now...
Elias Karakoulakis authored
42 }
43
44 loop {
45 sleep(1)
d545344 a first working version of the state mapper
Elias Karakoulakis authored
46 }
Something went wrong with that request. Please try again.