humble_rpi-plugin-photocell 0.1.0
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.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +3 -0
- data/lib/humble_rpi-plugin-photocell.rb +46 -0
- metadata +87 -0
- metadata.gz.sig +1 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 849d98fa4e7226226e7adc02e5f48b4e05d30ef2
|
4
|
+
data.tar.gz: 74884e53cf0de109c4525dd3987ed567ab03e2d3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 752e92d87f966382730b3cb5d1cd3d47c3d2ebbab1487c043b9c70afc29b8d245f658433f002422f0d4a2c5b70186d8b6898b11f129bdad9766e6fc2abd7c671
|
7
|
+
data.tar.gz: 3610125e23d810b6305a26de0013d006d023aee8914b11092f87971bbc281473145304601d0f84b6a3048a64469b55060df94329b9c559e9a2a263830eaea525
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# file: humble_rpi-plugin-photocell.rb
|
4
|
+
|
5
|
+
|
6
|
+
require 'rpi_photocell'
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
class HumbleRPiPluginPhotocell
|
11
|
+
|
12
|
+
|
13
|
+
def initialize(settings: {}, variables: {})
|
14
|
+
|
15
|
+
@channel = settings[:channel] || 0
|
16
|
+
@threshold = settings[:threshold] || 100
|
17
|
+
@notifier = variables[:notifier]
|
18
|
+
@device_id = variables[:device_id] || 'pi'
|
19
|
+
@photocell = RPiPhotocell.new pin: @channel
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
def start()
|
24
|
+
|
25
|
+
puts 'ready to monitor photocell'
|
26
|
+
old_val = @photocell.read
|
27
|
+
|
28
|
+
loop do
|
29
|
+
|
30
|
+
val = @photocell.read
|
31
|
+
|
32
|
+
if (old_val - val).abs >= @threshold then
|
33
|
+
@notifier.notice "%s/photocell: %s" % [@device_id, val]
|
34
|
+
end
|
35
|
+
|
36
|
+
old_val = val
|
37
|
+
sleep 1
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
alias on_start start
|
44
|
+
|
45
|
+
|
46
|
+
end
|
metadata
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: humble_rpi-plugin-photocell
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- James Robertson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
|
14
|
+
YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
|
15
|
+
8ixkARkWAmV1MB4XDTE2MDIxOTIwNDU1NFoXDTE3MDIxODIwNDU1NFowSDESMBAG
|
16
|
+
A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
|
17
|
+
EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
|
18
|
+
ggEBAMtWkAHIavzlvACIy51F5WEcsVe1gR3X/d6DQUAIs3mtoccT77+DMj7vke04
|
19
|
+
LevMiwBPCbVmjADUnloBJ0SrIADuZiVDRhdMYQzVY/mj4uxM5tdUCLmpzufhkm34
|
20
|
+
4xyXOGTQdzNh2dryeJBjVTj74bOI6+IFqBh4xoQJnc9qpmJLeMN/oVZPWr3D4+wF
|
21
|
+
sq4ew1hPMVAiy3IY7tECsO06Dici9wEw/uAhxIpFVRnRW5z9EgRCpAem7g7ZTFnx
|
22
|
+
ZEFtWrlpt2EHbRW57+Ld6ptyznRA6nzdQPbPdI5/oDVMBNU/x+yw7LQ0P5xTSbbS
|
23
|
+
C5WaEM0VN5jtyvv/sI/tX3fnp9sCAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
|
24
|
+
DwQEAwIEsDAdBgNVHQ4EFgQUxmtBup8nIhATKZ1wKHbsuD1U5AowJgYDVR0RBB8w
|
25
|
+
HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
|
26
|
+
c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAustwWkZi
|
27
|
+
60k2WewVascWjJcNAtdEiIzrfqPIJZTYmrtE7L4hwSqRsXme5m3b8maGMviPPxUZ
|
28
|
+
wo9u0rfrDZZRDpFemy987jQUR7nzw3Acw3U8bwYZhxoCMDfWXQ3j6Uh15es8WnyC
|
29
|
+
W38WrDsnukUJU2fwufjk/01YppNQeH3SVmt+rZVqJzjs9TZFL82ZG0Y57jy4bksM
|
30
|
+
D+q6d/AmZyiz2O7nliOGLImln4a+gKpXOin5IosI25uyf7VEok8cYZrPpU4XZThz
|
31
|
+
8tn78nnx9WlgQCN2xfac3P/nbNeP09Id8dDOXx/sOO0dL4+GbBmQGuRUpTUa9ZF3
|
32
|
+
7sLAGk5DpUDjqQ==
|
33
|
+
-----END CERTIFICATE-----
|
34
|
+
date: 2016-02-19 00:00:00.000000000 Z
|
35
|
+
dependencies:
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rpi_photocell
|
38
|
+
requirement: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0.1'
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.1.0
|
46
|
+
type: :runtime
|
47
|
+
prerelease: false
|
48
|
+
version_requirements: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - "~>"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0.1'
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 0.1.0
|
56
|
+
description:
|
57
|
+
email: james@r0bertson.co.uk
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- lib/humble_rpi-plugin-photocell.rb
|
63
|
+
homepage: https://github.com/jrobertson/humble_rpi-plugin-photocell
|
64
|
+
licenses:
|
65
|
+
- MIT
|
66
|
+
metadata: {}
|
67
|
+
post_install_message:
|
68
|
+
rdoc_options: []
|
69
|
+
require_paths:
|
70
|
+
- lib
|
71
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
requirements: []
|
82
|
+
rubyforge_project:
|
83
|
+
rubygems_version: 2.4.8
|
84
|
+
signing_key:
|
85
|
+
specification_version: 4
|
86
|
+
summary: A Humble RPi plugin to monitor ambient light levels.
|
87
|
+
test_files: []
|
metadata.gz.sig
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
�Ւ�'<�@�v.�4�����ɱ��p1r���i�E,�_��`|f�8��a18�i�Tac�hv�=?��v����JR�2�=(��aK8�8�������Ҩܱ��~o��nv#�||*��\����+;��u���#�:O����b��G��)��g�zh��H�S.�9�y���1W���8�e{d8Yp���vgX�2ebݕ���3�>�&C��َ��qc�;�h���r��W�������
|