huginn_myq_agent 0.2.1 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/huginn_myq_agent/myq_agent.rb +21 -26
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55877177d9b155925e11c501d26fd149223fcd66540c45b83cd737ba615c1ec4
|
4
|
+
data.tar.gz: 131e13c4cc6abf9e89b216a3d7e4accaef1cd00d6222b1a4bbcf81a99255db24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9cc9ee31241497d1ef6fba1cd3a328b9d3f29753285ecf11ad8936ef75760b863ff6866a7bcc874ff2b91610622640f6f46abcbe57ffc57bb2f650d664bc8e0
|
7
|
+
data.tar.gz: 51ef70a298d10b6b7c453ed68eb62e477b8eaba0664f74aff2c224e63713a2deda29310446f1cc43b92096bc363c28bb7f3e39f08c0a6cc0ee0c2341af16b753
|
@@ -3,11 +3,10 @@ require 'ruby_myq'
|
|
3
3
|
module Agents
|
4
4
|
class MyqAgent < Agent
|
5
5
|
include FormConfigurable
|
6
|
-
cannot_receive_events!
|
7
6
|
default_schedule '12h'
|
8
7
|
|
9
8
|
description <<-MD
|
10
|
-
|
9
|
+
Allows for the control of a Chamberlain MyQ garage door.
|
11
10
|
MD
|
12
11
|
|
13
12
|
def default_options
|
@@ -38,23 +37,32 @@ module Agents
|
|
38
37
|
end
|
39
38
|
|
40
39
|
def working?
|
41
|
-
|
42
|
-
|
40
|
+
!recent_error_logs?
|
41
|
+
end
|
42
|
+
|
43
|
+
def complete_door_name
|
44
|
+
system = create_system
|
45
|
+
system.garage_doors.map { |door| {id: door.name, text: door.name} }
|
43
46
|
end
|
44
47
|
|
45
48
|
def check
|
46
49
|
door = select_door(interpolated['door_name'])
|
47
50
|
if interpolated['action'] == 'status'
|
48
|
-
create_event :payload => status(door
|
51
|
+
create_event :payload => status(door)
|
49
52
|
elsif interpolated['action'] == 'open'
|
50
53
|
open_door(door)
|
51
|
-
create_event :payload => status(door
|
54
|
+
create_event :payload => status(door)
|
52
55
|
elsif interpolated['action'] == 'close'
|
53
|
-
|
54
|
-
create_event :payload => status(door
|
56
|
+
close_door(door)
|
57
|
+
create_event :payload => status(door)
|
58
|
+
elsif interpolated['action'] == 'toggle'
|
59
|
+
toggle_door(door)
|
60
|
+
create_event :payload => status(door)
|
55
61
|
end
|
56
62
|
end
|
57
63
|
|
64
|
+
private
|
65
|
+
|
58
66
|
def create_system
|
59
67
|
system = RubyMyq::System.new(interpolated['email_address'],interpolated['password'])
|
60
68
|
end
|
@@ -64,27 +72,23 @@ module Agents
|
|
64
72
|
door = system.find_door_by_name(door_name)
|
65
73
|
end
|
66
74
|
|
67
|
-
def status(
|
68
|
-
door = select_door(door_name)
|
75
|
+
def status(door)
|
69
76
|
status = {
|
77
|
+
'name' => door.name,
|
70
78
|
'state' => door.status,
|
71
79
|
'since' => door.status_since
|
72
80
|
}
|
73
|
-
return status
|
74
81
|
end
|
75
82
|
|
76
|
-
def close_door(
|
77
|
-
door = select_door(door_name)
|
83
|
+
def close_door(door)
|
78
84
|
door.close
|
79
85
|
end
|
80
86
|
|
81
|
-
def open_door(
|
82
|
-
door = select_door(door_name)
|
87
|
+
def open_door(door)
|
83
88
|
door.open
|
84
89
|
end
|
85
90
|
|
86
|
-
def toggle_door(
|
87
|
-
door = select_door(door_name)
|
91
|
+
def toggle_door(door)
|
88
92
|
if door.status == "open"
|
89
93
|
door.close
|
90
94
|
elsif door.status == "closed"
|
@@ -92,14 +96,5 @@ module Agents
|
|
92
96
|
end
|
93
97
|
end
|
94
98
|
|
95
|
-
def complete_door_name
|
96
|
-
system = create_system
|
97
|
-
system.garage_doors.map { |door| door.name }
|
98
|
-
end
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
# def receive(incoming_events)
|
103
|
-
# end
|
104
99
|
end
|
105
100
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: huginn_myq_agent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jesse Gillies
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-11-
|
11
|
+
date: 2020-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 0.0.1
|
69
|
-
description:
|
69
|
+
description:
|
70
70
|
email:
|
71
71
|
- jessegillies@gmail.com
|
72
72
|
executables: []
|
@@ -99,6 +99,6 @@ requirements: []
|
|
99
99
|
rubygems_version: 3.0.3
|
100
100
|
signing_key:
|
101
101
|
specification_version: 4
|
102
|
-
summary:
|
102
|
+
summary: Huginn agent for controlling Chamberlain MyQ garage doors.
|
103
103
|
test_files:
|
104
104
|
- spec/myq_agent_spec.rb
|