huginn_myq_agent 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b2331ec7bd9ff12e905c2c4f8c89d171a29c01c3857af1ec17aef064f1b3226b
4
- data.tar.gz: 418b1c8d4da4e3722fbaf14cc8686501c6fd030cc69cfb64610edd7fcb524d5a
3
+ metadata.gz: 22ebb0df9739af60226e463ea6468fe1501513f243beca6ddde073d458495c22
4
+ data.tar.gz: 8ea02626edc18e961e290559564d0a1a5608c6301594858a8932ca361971e6ad
5
5
  SHA512:
6
- metadata.gz: 0eab2866a3bcb63bc48279edb8c9180b04d4a6219fba4b188dc07b31e8218d29c4e5366917a03349603f068737f8eba96a5b20ebd92dd447ae4a5e9deefa6295
7
- data.tar.gz: a991bf323bf15d0c76ee87b54639a56606fb20324689a4de0b8958f26099359c356f4e4ab5c91b2051cbcda435056bafc8a131461a1d08c422218271b948c2b0
6
+ metadata.gz: bf2b063dede17692b573450be4ce66a33875c55bb7427bc5d4bc2d176bd1086ce262379f0dfb04a82781c0006ab442532f3ea410fd5e689c110dd547cb5eb0f8
7
+ data.tar.gz: 3c1a325fd24fb0bbfd392c91560a835d99ec256641ef1f58a4e5d5b67302516ae207e2cc7602e7453c88b3ebae0a804becf7b581a2d6238115d4ab41b75a31cf
@@ -7,7 +7,7 @@ module Agents
7
7
  default_schedule '12h'
8
8
 
9
9
  description <<-MD
10
- Add a Agent description here
10
+ Allows for the control of a Chamberlain MyQ garage door.
11
11
  MD
12
12
 
13
13
  def default_options
@@ -38,8 +38,12 @@ module Agents
38
38
  end
39
39
 
40
40
  def working?
41
- # Implement me! Maybe one of these next two lines would be a good fit?
42
- received_event_without_error?
41
+ !recent_error_logs?
42
+ end
43
+
44
+ def complete_door_name
45
+ system = create_system
46
+ system.garage_doors.map { |door| {id: door.name, text: door.name} }
43
47
  end
44
48
 
45
49
  def check
@@ -55,6 +59,8 @@ module Agents
55
59
  end
56
60
  end
57
61
 
62
+ private
63
+
58
64
  def create_system
59
65
  system = RubyMyq::System.new(interpolated['email_address'],interpolated['password'])
60
66
  end
@@ -64,27 +70,23 @@ module Agents
64
70
  door = system.find_door_by_name(door_name)
65
71
  end
66
72
 
67
- def status(door_name)
68
- door = select_door(door_name)
73
+ def status(door)
69
74
  status = {
75
+ 'name' => door.name,
70
76
  'state' => door.status,
71
77
  'since' => door.status_since
72
78
  }
73
- return status
74
79
  end
75
80
 
76
- def close_door(door_name)
77
- door = select_door(door_name)
81
+ def close_door(door)
78
82
  door.close
79
83
  end
80
84
 
81
- def open_door(door_name)
82
- door = select_door(door_name)
85
+ def open_door(door)
83
86
  door.open
84
87
  end
85
88
 
86
- def toggle_door(door_name)
87
- door = select_door(door_name)
89
+ def toggle_door(dorr)
88
90
  if door.status == "open"
89
91
  door.close
90
92
  elsif door.status == "closed"
@@ -92,14 +94,5 @@ module Agents
92
94
  end
93
95
  end
94
96
 
95
- def complete_door_name
96
- system = create_system
97
- system.garage_doors.map { |door| {id: door.name, text: door.name} }
98
- end
99
-
100
-
101
-
102
- # def receive(incoming_events)
103
- # end
104
97
  end
105
98
  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.2
4
+ version: 0.2.3
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-13 00:00:00.000000000 Z
11
+ date: 2020-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler