rzwaveway 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/rzwaveway/command_classes.rb +0 -3
- data/lib/rzwaveway/zwave_device.rb +5 -7
- data/lib/rzwaveway/zway.rb +14 -4
- data/lib/rzwaveway.rb +4 -4
- data/rzwaveway.gemspec +14 -2
- metadata +18 -2
@@ -1,7 +1,5 @@
|
|
1
1
|
require 'json'
|
2
2
|
|
3
|
-
require_relative 'command_classes'
|
4
|
-
|
5
3
|
module RZWaveWay
|
6
4
|
class ZWaveDevice
|
7
5
|
include CommandClasses
|
@@ -11,7 +9,7 @@ module RZWaveWay
|
|
11
9
|
def initialize(id, data)
|
12
10
|
@id = id
|
13
11
|
@command_classes = create_commandclasses_from data
|
14
|
-
|
12
|
+
$log.info "Created ZWaveDevice with id='#{id}'"
|
15
13
|
end
|
16
14
|
|
17
15
|
def create_commandclasses_from data
|
@@ -56,7 +54,8 @@ module RZWaveWay
|
|
56
54
|
if @command_classes.has_key? cc
|
57
55
|
events << (@command_classes[cc].process(values, @id))
|
58
56
|
else
|
59
|
-
|
57
|
+
$log.warn "Could not find command class: '#{cc}'"
|
58
|
+
end
|
60
59
|
end
|
61
60
|
events
|
62
61
|
end
|
@@ -71,11 +70,10 @@ module RZWaveWay
|
|
71
70
|
cc_updates << [match_data.post_match, value]
|
72
71
|
updates_per_commandclass[command_class] = cc_updates
|
73
72
|
else
|
74
|
-
|
73
|
+
$log.warn "? #{key}" unless key.match(/\Adata./)
|
75
74
|
end
|
76
75
|
end
|
77
76
|
updates_per_commandclass
|
78
77
|
end
|
79
|
-
|
80
78
|
end
|
81
|
-
end
|
79
|
+
end
|
data/lib/rzwaveway/zway.rb
CHANGED
@@ -1,9 +1,19 @@
|
|
1
1
|
require 'uri'
|
2
|
+
require 'log4r'
|
2
3
|
require 'net/http'
|
3
4
|
require 'json'
|
4
5
|
|
5
6
|
module RZWaveWay
|
6
7
|
class ZWay
|
8
|
+
include Log4r
|
9
|
+
|
10
|
+
def self.init
|
11
|
+
$log = Logger.new 'RZWaveWay'
|
12
|
+
outputter = Outputter.stdout
|
13
|
+
outputter.formatter = PatternFormatter.new(:pattern => "[%l] %d - %m")
|
14
|
+
$log.outputters = Outputter.stdout
|
15
|
+
end
|
16
|
+
|
7
17
|
def initialize hostname
|
8
18
|
@devices = {}
|
9
19
|
@update_time = "0"
|
@@ -36,7 +46,7 @@ module RZWaveWay
|
|
36
46
|
if @devices[id]
|
37
47
|
events.concat (@devices[id].process updates)
|
38
48
|
else
|
39
|
-
|
49
|
+
$log.warn "Could not find device with id '#{id}'"
|
40
50
|
end
|
41
51
|
end
|
42
52
|
events.each do |event|
|
@@ -44,7 +54,7 @@ module RZWaveWay
|
|
44
54
|
if handler
|
45
55
|
handler.call(event)
|
46
56
|
else
|
47
|
-
|
57
|
+
$log.warn "no handler for #{event.class}"
|
48
58
|
end
|
49
59
|
end
|
50
60
|
events
|
@@ -73,7 +83,7 @@ module RZWaveWay
|
|
73
83
|
device_updates << [match_data.post_match, value]
|
74
84
|
updates_per_device[device_id] = device_updates
|
75
85
|
else
|
76
|
-
|
86
|
+
$log.warn "? #{key}"
|
77
87
|
end
|
78
88
|
end
|
79
89
|
updates_per_device
|
@@ -91,4 +101,4 @@ module RZWaveWay
|
|
91
101
|
@event_handlers[event] = listener
|
92
102
|
end
|
93
103
|
end
|
94
|
-
end
|
104
|
+
end
|
data/lib/rzwaveway.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
require_relative 'rzwaveway/command_classes'
|
2
|
+
require_relative 'rzwaveway/events'
|
3
|
+
require_relative 'rzwaveway/zwave_device'
|
4
|
+
require_relative 'rzwaveway/zway'
|
data/rzwaveway.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "rzwaveway"
|
3
|
-
s.version = "0.0.
|
3
|
+
s.version = "0.0.2"
|
4
4
|
s.authors = ["Vincent Touchard"]
|
5
5
|
s.date = %q{2014-02-08}
|
6
6
|
s.summary = 'ZWave API for ZWay'
|
@@ -9,4 +9,16 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.homepage = 'https://github.com/rzwaveway'
|
10
10
|
s.files = `git ls-files`.split("\n")
|
11
11
|
s.has_rdoc = false
|
12
|
-
|
12
|
+
|
13
|
+
dependencies = [
|
14
|
+
[:runtime, "log4r", "~> 1.1.10"]
|
15
|
+
]
|
16
|
+
|
17
|
+
dependencies.each do |type, name, version|
|
18
|
+
if s.respond_to?("add_#{type}_dependency")
|
19
|
+
s.send("add_#{type}_dependency", name, version)
|
20
|
+
else
|
21
|
+
s.add_dependency(name, version)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rzwaveway
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,23 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
date: 2014-02-08 00:00:00.000000000 Z
|
13
|
-
dependencies:
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: log4r
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.1.10
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.1.10
|
14
30
|
description: A Ruby API to use the Razberry ZWave ZWay interface
|
15
31
|
email: vincentoo@yahoo.com
|
16
32
|
executables: []
|