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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6bbf489c3434fd3286bde5562929e44a20aff6ccbeca10099f266cb964d5178b
4
- data.tar.gz: f9e0fbc594620f534e78db5bbc08dc177b96dfa820a2280fd82665685913d430
3
+ metadata.gz: 55877177d9b155925e11c501d26fd149223fcd66540c45b83cd737ba615c1ec4
4
+ data.tar.gz: 131e13c4cc6abf9e89b216a3d7e4accaef1cd00d6222b1a4bbcf81a99255db24
5
5
  SHA512:
6
- metadata.gz: 03c520d7611d3b4a663c6ff45d9b5822aa0d0c4ed931a505c23476b04d9a6fe0bc37f59229bb289cfc4c9be06cea696743b35aff4b84d4ccd04f9b0bee5cc8e0
7
- data.tar.gz: d9b0a0e2f5f9320a40769eee3bfbb33283a049c1a4d03e98d3aa7a87b22882963ad277a2e308582489d0956f0976819d68819543bf06454cc353e2694cd99c0a
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
- Add a Agent description here
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
- # Implement me! Maybe one of these next two lines would be a good fit?
42
- received_event_without_error?
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.name)
51
+ create_event :payload => status(door)
49
52
  elsif interpolated['action'] == 'open'
50
53
  open_door(door)
51
- create_event :payload => status(door.name)
54
+ create_event :payload => status(door)
52
55
  elsif interpolated['action'] == 'close'
53
- close(door)
54
- create_event :payload => status(door.name)
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(door_name)
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(door_name)
77
- door = select_door(door_name)
83
+ def close_door(door)
78
84
  door.close
79
85
  end
80
86
 
81
- def open_door(door_name)
82
- door = select_door(door_name)
87
+ def open_door(door)
83
88
  door.open
84
89
  end
85
90
 
86
- def toggle_door(door_name)
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.1
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-13 00:00:00.000000000 Z
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: Write a longer description or delete this line.
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: Write a short summary, because Rubygems requires one.
102
+ summary: Huginn agent for controlling Chamberlain MyQ garage doors.
103
103
  test_files:
104
104
  - spec/myq_agent_spec.rb