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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/humble_rpi-plugin-photocell.rb +8 -6
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 614f9107857b12f9f7d4e2fb3aab50303cacd92b
|
4
|
+
data.tar.gz: 361f336948d95e9432b5db2825535de6a7064254
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 08cea378d332e8d99e59b0916dd4c39489dd8457eb4faaa9a0e8c48b73aa560b7100fd8c3ed1391f9047f649ce742197298155638a8c3a8bc28bbaff91cbec10
|
7
|
+
data.tar.gz: 73834d19c76bcb10aeb6adfef722efd2a51ee4f4aaff1fefe6d41717bc9746ce76aa7ebcf550886ec9f1db90c43f4282e87c944691de333cbebe4c9e8ef1f235
|
checksums.yaml.gz.sig
CHANGED
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] ||
|
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
|
-
|
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
|
-
|
35
|
-
|
36
|
-
|
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.
|
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-
|
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
|