myfirmata-plugin-pir 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/myfirmata-plugin-pir.rb +8 -5
- 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: 24a6033acea1d918f99f722db7edb6c3de1afc80
|
4
|
+
data.tar.gz: c32aed2902c2db06510754f553d06b79f8c8b682
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a61e8fea855c9cb7188a91bcb7c664486930f861bb71010adb45e0a69e9d442fe5eba90ac55dcc1d3daf6ed60924744550c7408011d5324c5b4600c08cfd5a8
|
7
|
+
data.tar.gz: 3054ca7ae0774dca0c5351a421d2ff894007753fd494a7cfae7fe49d42e1cd5269f91f1dbdc800f80deb6abbe3a8350457ee91cc99568cb018f91d714fd47b13
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/myfirmata-plugin-pir.rb
CHANGED
@@ -32,8 +32,9 @@ class MyFirmataPluginPir
|
|
32
32
|
duration = @duration
|
33
33
|
notifier = @variables[:notifier]
|
34
34
|
topic = @variables[:device_id]
|
35
|
-
msg = @settings[:msg] || 'motion'
|
35
|
+
msg = @settings[:msg] || 'motion'
|
36
36
|
pinx = @pinx
|
37
|
+
threshold = @settings[:threshold] || 5
|
37
38
|
|
38
39
|
t1 = Time.now - (ChronicDuration.parse(duration) + 10)
|
39
40
|
|
@@ -47,9 +48,11 @@ class MyFirmataPluginPir
|
|
47
48
|
|
48
49
|
if Time.now > t1 + ChronicDuration.parse(duration) then
|
49
50
|
|
50
|
-
|
51
|
-
|
52
|
-
|
51
|
+
if count > threshold then
|
52
|
+
notifier.notice \
|
53
|
+
"%s/motion: detected %s times within the past %s" % \
|
54
|
+
[topic, count, duration]
|
55
|
+
end
|
53
56
|
t1 = Time.now
|
54
57
|
count = 0
|
55
58
|
end
|
@@ -61,4 +64,4 @@ class MyFirmataPluginPir
|
|
61
64
|
|
62
65
|
alias on_start start
|
63
66
|
|
64
|
-
end
|
67
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: myfirmata-plugin-pir
|
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
|
qMYLyGZ6oqlJmCNJX+A9uVxKxLexn/B/52sLuZG+r6bZ0zGkKX1nmazfaBg7FM/4
|
32
32
|
RFgXKXS9Q8TOzA==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2017-
|
34
|
+
date: 2017-05-09 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: chronic_duration
|
metadata.gz.sig
CHANGED
Binary file
|