humble_rpi 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ef8ca4230da5fbc36aeff2120991804ad79b40d2
4
- data.tar.gz: adfa115c3d2b606a738e3175c6f60666980247c9
3
+ metadata.gz: 41cfe2fe8b95395063bec36af5c1059311993f25
4
+ data.tar.gz: c786475c516c1f6285feda3b00bfc78c66a61367
5
5
  SHA512:
6
- metadata.gz: 592d05f8b84d527338fdef77f9fc8857d7713e1c144b92f437a50c749ab652d4b07db18a544d0f234b4458f8bca1dfe42e6a49428540c67ac24b5d5b862d3f15
7
- data.tar.gz: 1427bc63a28629178d40a73727ecc8d38f1e92f5da23fec2bde6eac5b79bbb68c550dcee17723f4c46f4c88c83dde2fb2af3d69dc2f59d523f918b784ea5b295
6
+ metadata.gz: d3e0a0da906c1edd9bcbc41bf15de32ab4ca8172212c9ffa8900fbf8e71faafeaa9aac93628feb99a2d5938620ad7c8bd0097bbc1252f128a300d3fa453a303d
7
+ data.tar.gz: b250f6ba9fc7d648f7f756c9adf9ebf99d40e8f9db9b228728f9569a8ea071a32852265b9b48a08e982e9b239d14149e79c0f688fe3b9905e7b0a027c982750c
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/humble_rpi.rb CHANGED
@@ -12,6 +12,7 @@ class HumbleRPi < RPi
12
12
 
13
13
  def initialize(options={})
14
14
 
15
+ puts 'inside humble_rpi'
15
16
  default_options = {
16
17
  device_name: 'rpi',
17
18
  led_pins: [],
@@ -22,12 +23,11 @@ class HumbleRPi < RPi
22
23
 
23
24
  @opt = default_options.merge options
24
25
  super @opt[:led_pins]
25
- @ws, @rpi = nil, nil
26
+ @ws = nil
26
27
  end
27
28
 
28
29
  def led_listener(&blk)
29
- @rpi = self
30
- rpi = @rpi
30
+ rpi = self
31
31
 
32
32
  c = WebSocket::EventMachine::Client
33
33
 
@@ -37,9 +37,8 @@ class HumbleRPi < RPi
37
37
 
38
38
  @ws = c.connect(uri: "ws://%s:%s" % [@opt[:sps_address], @opt[:sps_port]])
39
39
 
40
- ws.onopen do
40
+ @ws.onopen do
41
41
  puts "Client connected"
42
- #@ws = ws
43
42
  end
44
43
 
45
44
  @ws.onmessage(&blk)
@@ -51,6 +50,7 @@ class HumbleRPi < RPi
51
50
  EventMachine.next_tick do
52
51
  @ws.send "subscribe to topic: #{@opt[:device_name]}_led"
53
52
  end
53
+
54
54
  EventMachine.error_handler{ |e|
55
55
  puts "Error raised during event loop: #{e.message}"
56
56
 
@@ -66,10 +66,10 @@ class HumbleRPi < RPi
66
66
 
67
67
  t1 = Time.now
68
68
  ws, opt = @ws, @opt
69
-
69
+ puts 'inside motion //'
70
70
  after pin: opt[:motion_pin].to_i, goes: :high do
71
71
 
72
- #puts Time.now.to_s + ' : motion detected'
72
+ puts Time.now.to_s + ' : motion detected'
73
73
 
74
74
  if Time.now > t1 + ChronicDuration.parse('1 minute') then
75
75
  ws.send opt[:device_name] + ': motion detected'
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: humble_rpi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file