nature_remo 0.1.2 → 0.2.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 +4 -4
- data/README.md +15 -8
- data/lib/nature_remo/cli.rb +15 -2
- data/lib/nature_remo/client.rb +11 -0
- data/lib/nature_remo/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da4582aed4985cd7f6509c57b52e2bef203b3bdbb708bd016ae69ebbd5252f10
|
4
|
+
data.tar.gz: e45b9c1295182becc2ac8550ef3d1d15d3e045d67d7a0f741ead15d524d7b691
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d0dfd3a0576d17b93bc4e83f216ec1e079ebc9b7e08c04a11de8456751f312592564ed22d620d93fc17ce8c7e759796fd9b977421736067719529042a6f91fd
|
7
|
+
data.tar.gz: 4d6b7fc692552c5ee6dfd59114d408b75018d981655c796bd9df23280f561061aad6fec3e6b7fe6db092295ee617c3718dc6557bc5bb56e3b623f54d60f9d730
|
data/README.md
CHANGED
@@ -22,20 +22,24 @@ Or install it yourself as:
|
|
22
22
|
## Usage
|
23
23
|
|
24
24
|
Commands:
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
25
|
+
natureremo aircon MODE TEMP # Control Air conditioner
|
26
|
+
natureremo appliances ID SIGNAL # Access a appliance
|
27
|
+
natureremo devices # find all devices
|
28
|
+
natureremo help [COMMAND] # Describe available commands or one specific command
|
29
|
+
natureremo me # print nickname
|
30
|
+
natureremo temp # Get temperture and humidity
|
29
31
|
|
30
|
-
###
|
32
|
+
### Example
|
31
33
|
|
32
|
-
|
34
|
+
#### Control appliance
|
35
|
+
|
36
|
+
Show appliances list
|
33
37
|
|
34
38
|
$ natureremo appliances
|
35
39
|
0: スピーカー
|
36
40
|
1: シーリングライト
|
37
41
|
|
38
|
-
|
42
|
+
Show signal list
|
39
43
|
|
40
44
|
$ natureremo appliances 1
|
41
45
|
0: 全光
|
@@ -43,10 +47,13 @@ show signal list
|
|
43
47
|
2: 常夜灯
|
44
48
|
3: 消灯
|
45
49
|
|
46
|
-
|
50
|
+
Send signal
|
47
51
|
|
48
52
|
$ natureremo appliances 1 0
|
49
53
|
|
54
|
+
#### Control air conditioner
|
55
|
+
|
56
|
+
$ natureremo aircon [mode] [temperture] [options]
|
50
57
|
|
51
58
|
<!-- ## Development -->
|
52
59
|
|
data/lib/nature_remo/cli.rb
CHANGED
@@ -24,6 +24,9 @@ module NatureRemo
|
|
24
24
|
client.send_signal(signal)
|
25
25
|
puts 'done'
|
26
26
|
elsif appliance_num
|
27
|
+
if appliances_body[appliance_num.to_i]["type"] == "AC"
|
28
|
+
puts "Use 'aircon' command."
|
29
|
+
end
|
27
30
|
appliances_body[appliance_num.to_i]["signals"].each_with_index do |signal,i|
|
28
31
|
puts "#{i}: #{signal["name"]}"
|
29
32
|
end
|
@@ -34,11 +37,21 @@ module NatureRemo
|
|
34
37
|
end
|
35
38
|
end
|
36
39
|
|
40
|
+
desc 'aircon MODE TEMP', 'Control Air conditioner'
|
41
|
+
def aircon mode = nil, temp = nil, volume = nil
|
42
|
+
aircon_id = []
|
43
|
+
appliances_body.each_with_index do |a, i|
|
44
|
+
aircon_id << get_appliance_id(i) if a["type"] == "AC"
|
45
|
+
end
|
46
|
+
if aircon_id.length == 1
|
47
|
+
client.aircon_setting aircon_id.first, temp, mode, volume
|
48
|
+
# This method supports only one air conditioner
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
37
52
|
desc 'temp', 'Get temperture and humidity'
|
38
53
|
def temp
|
39
54
|
value = client.events
|
40
|
-
# value << client.events["te"]["val"]
|
41
|
-
# value << client.events["hu"]["val"]
|
42
55
|
puts "Temperture: #{value["te"]["val"]}℃"
|
43
56
|
puts "Humidity: #{value["hu"]["val"]}%"
|
44
57
|
end
|
data/lib/nature_remo/client.rb
CHANGED
@@ -42,6 +42,17 @@ module NatureRemo
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
+
def aircon_setting appliance, mode = nil, temp = nil, volume = nil
|
46
|
+
@client.post do |req|
|
47
|
+
req.url "/1/appliances/#{appliance}/aircon_settings"
|
48
|
+
req.body = {
|
49
|
+
:temperature => "#{temp}",
|
50
|
+
:operation_mode => "#{mode}",
|
51
|
+
:air_volume => "#{volume}"
|
52
|
+
}
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
45
56
|
def events
|
46
57
|
JSON.parse(self.devices.body)[0]["newest_events"]
|
47
58
|
end
|
data/lib/nature_remo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nature_remo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ichi-t
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|