humble_rpi-plugin-photocell 0.1.0 → 0.1.1

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: 849d98fa4e7226226e7adc02e5f48b4e05d30ef2
4
- data.tar.gz: 74884e53cf0de109c4525dd3987ed567ab03e2d3
3
+ metadata.gz: 614f9107857b12f9f7d4e2fb3aab50303cacd92b
4
+ data.tar.gz: 361f336948d95e9432b5db2825535de6a7064254
5
5
  SHA512:
6
- metadata.gz: 752e92d87f966382730b3cb5d1cd3d47c3d2ebbab1487c043b9c70afc29b8d245f658433f002422f0d4a2c5b70186d8b6898b11f129bdad9766e6fc2abd7c671
7
- data.tar.gz: 3610125e23d810b6305a26de0013d006d023aee8914b11092f87971bbc281473145304601d0f84b6a3048a64469b55060df94329b9c559e9a2a263830eaea525
6
+ metadata.gz: 08cea378d332e8d99e59b0916dd4c39489dd8457eb4faaa9a0e8c48b73aa560b7100fd8c3ed1391f9047f649ce742197298155638a8c3a8bc28bbaff91cbec10
7
+ data.tar.gz: 73834d19c76bcb10aeb6adfef722efd2a51ee4f4aaff1fefe6d41717bc9746ce76aa7ebcf550886ec9f1db90c43f4282e87c944691de333cbebe4c9e8ef1f235
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -13,7 +13,7 @@ class HumbleRPiPluginPhotocell
13
13
  def initialize(settings: {}, variables: {})
14
14
 
15
15
  @channel = settings[:channel] || 0
16
- @threshold = settings[:threshold] || 100
16
+ @threshold = settings[:threshold] || 10
17
17
  @notifier = variables[:notifier]
18
18
  @device_id = variables[:device_id] || 'pi'
19
19
  @photocell = RPiPhotocell.new pin: @channel
@@ -23,7 +23,9 @@ class HumbleRPiPluginPhotocell
23
23
  def start()
24
24
 
25
25
  puts 'ready to monitor photocell'
26
- old_val = @photocell.read
26
+
27
+ @notifier.notice "%s/photocell: %s" % [@device_id, val=@photocell.read]
28
+ old_val = val
27
29
 
28
30
  loop do
29
31
 
@@ -31,9 +33,9 @@ class HumbleRPiPluginPhotocell
31
33
 
32
34
  if (old_val - val).abs >= @threshold then
33
35
  @notifier.notice "%s/photocell: %s" % [@device_id, val]
34
- end
35
-
36
- old_val = val
36
+ old_val = val
37
+ end
38
+
37
39
  sleep 1
38
40
 
39
41
  end
@@ -43,4 +45,4 @@ class HumbleRPiPluginPhotocell
43
45
  alias on_start start
44
46
 
45
47
 
46
- end
48
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: humble_rpi-plugin-photocell
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  8tn78nnx9WlgQCN2xfac3P/nbNeP09Id8dDOXx/sOO0dL4+GbBmQGuRUpTUa9ZF3
32
32
  7sLAGk5DpUDjqQ==
33
33
  -----END CERTIFICATE-----
34
- date: 2016-02-19 00:00:00.000000000 Z
34
+ date: 2016-02-20 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rpi_photocell
metadata.gz.sig CHANGED
Binary file