humble_rpi-plugin-doorlock 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1b98cb2c9bdd70a19d4385df15b4f6678575efcb
4
+ data.tar.gz: 58ffb194af886ce110c417d1dc329c3875deacd7
5
+ SHA512:
6
+ metadata.gz: 046c14de369619fc82b131e33db45a75bc6f640e68bcc1224f6eea6addf03f94fbba3c923e9da6aeeed54e4e7393cc546ebed6cf6c755f4b5b9d1426f9a723e6
7
+ data.tar.gz: 72dfb7c9bb3a441d230f0e56985e639c255adea5c974678cbc707be2851cf9034f534f565c234f0cab3c739aadafb6b209a02af4d5ed92a51692886fd7172c73
checksums.yaml.gz.sig ADDED
Binary file
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: humble_rpi-plugin-doorlock.rb
4
+
5
+
6
+ require 'rpi'
7
+
8
+
9
+ class HumbleRPiPluginDoorLock
10
+
11
+ def initialize(settings: {}, variables: {})
12
+
13
+ @gpio_pins = settings[:pins]
14
+
15
+ end
16
+
17
+ def on_doorlock_message(message)
18
+
19
+ r = message.match(/(\d+)?\s*(open|close|lock|unlock)\s*(?:\s*duration\s)?([\d\.]+)?/)
20
+
21
+ if r then
22
+
23
+ index, state, raw_duration = r.captures
24
+ index ||= 0
25
+
26
+ duration = raw_duration ? raw_duration.to_f : nil
27
+
28
+ a = case state
29
+
30
+ when 'open'
31
+ [:unlock]
32
+ when 'unlock'
33
+ [:unlock]
34
+ when 'close'
35
+ [:lock]
36
+ when 'lock'
37
+ [:lock]
38
+ end
39
+
40
+ @door[index.to_i].send(*a)
41
+ end
42
+ end
43
+
44
+ def start()
45
+
46
+ @door = RPi.new(@gpio_pins).pins if @gpio_pins.any?
47
+
48
+ end
49
+
50
+ alias on_start start
51
+
52
+ def on_exit()
53
+ @door.on_exit
54
+ end
55
+
56
+ end
data.tar.gz.sig ADDED
Binary file
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: humble_rpi-plugin-doorlock
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
+ 8ixkARkWAmV1MB4XDTE2MDEyNjIwMDIxM1oXDTE3MDEyNTIwMDIxM1owSDESMBAG
16
+ A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
+ EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
18
+ ggEBAOlNkkDTuUU/O13u4MK9zt4aCXql7aYr/lcpEEi5un4+kVitxrF+H271dvvP
19
+ qCBUWI66WsgHiR1+mA4OWBtEQET1BqaAhIXXVuX6RrlVt01bAHNSZsz1lrpZbj1J
20
+ ZdXYsI+Cqo0X4hndOj6XEYds89cWwmIMj5se69aCryGLk5anBt51sqQbkcR8tYtE
21
+ AylVfH4dZDOhToPIDtNO0hF+qEQk7SxlQ5ZUXzuTtJjSe44cXPOOsFSd4pRrNofv
22
+ iWGi8vTiB2BB2rnOnCwzTfu/qrSOwqwI0o2/unECBGlVc77Dt6KYSfB53jSIo4XN
23
+ XPWmO0PCkUwWuFiFkyWgadGHZH8CAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
24
+ DwQEAwIEsDAdBgNVHQ4EFgQUYLhpbzJXTZ7kxpX4S4VE3faHdgIwJgYDVR0RBB8w
25
+ HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
26
+ c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAmhtXzdeW
27
+ SOQo1bkRVAeFCVa42SSSt5HLiK6t8pFi0Rv2WmXwjJsGoEv2nTVeofPcqfrMcH83
28
+ HZo8AH6b7A4eppN0u8vinGSuvrvIrt/WnOrOcvpOrxiOE0qYp0xtXYe1ycD7YGbJ
29
+ JuMc4jBwn0ylNuVdIpdBaVt8mJJkKmoiZJEVx9trjR1wyCgUP4kxO31LotR4Q/Vo
30
+ 9atbDp7pK67g47MUClcALUGvih7LFOawzFmsX4NQ6O03Mrr0O1qfNsEMbFxlruj4
31
+ mhEhbImSthM6yo9kwZpZn19VnbgaSyZVO6v3pcIwOWSQuKL+3R9+vI/drlxsu9vv
32
+ JIF0EnNhfAe6Gw==
33
+ -----END CERTIFICATE-----
34
+ date: 2016-01-26 00:00:00.000000000 Z
35
+ dependencies:
36
+ - !ruby/object:Gem::Dependency
37
+ name: rpi
38
+ requirement: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: '0.4'
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 0.4.2
46
+ type: :runtime
47
+ prerelease: false
48
+ version_requirements: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: '0.4'
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 0.4.2
56
+ description:
57
+ email: james@r0bertson.co.uk
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - lib/humble_rpi-plugin-doorlock.rb
63
+ homepage: https://github.com/jrobertson/humble_rpi-plugin-doorlock
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: humble_rpi-plugin-doorlock
87
+ test_files: []
metadata.gz.sig ADDED
Binary file