wh2600 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wh2600.rb +8 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89e331e701c722c90a6ee0c3e60b7c466f1de641
|
4
|
+
data.tar.gz: 567152cb95ae18bb101b99e1b20f4c736c6ea778
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77bf8ea79446ce9a66686bfff4272132eb68e7de3caee4c25101f9f1c9cac99dd0e95dd92f6470851210f87cb5f8e31866a804aad358e35ce44247881a77987a
|
7
|
+
data.tar.gz: a73c1827350b8e667ce8c807157ff0a8143471489b905af087e6b5cbcb8d975b35f6297520c99e967bff970f7af8d0ae993f18b0f103b0bef11fc90005c6f1bc
|
data/lib/wh2600.rb
CHANGED
@@ -2,15 +2,14 @@ require 'nokogiri'
|
|
2
2
|
require 'open-uri'
|
3
3
|
|
4
4
|
class Wh2600
|
5
|
-
def initialize(ip_address
|
5
|
+
def initialize(ip_address)
|
6
6
|
@ip_address = ip_address
|
7
|
-
@time_zone = time_zone
|
8
7
|
end
|
9
8
|
|
10
9
|
def get_data(live_data_uri='livedata.htm')
|
11
10
|
data = {}
|
12
11
|
data_html = Nokogiri::HTML(open_page(live_data_uri))
|
13
|
-
data['
|
12
|
+
data['station_datetime'] = Time.strptime(data_html.at_xpath('//input[@name="CurrTime"]').attr('value'), '%H:%M %m/%d/%Y')
|
14
13
|
data['sensors'] = {}
|
15
14
|
data['sensors']['indoor_id'] = data_html.at_xpath('//input[@name="IndoorID"]').attr('value')
|
16
15
|
data['sensors']['outdoor1_id'] = data_html.at_xpath('//input[@name="Outdoor1ID"]').attr('value')
|
@@ -32,12 +31,12 @@ class Wh2600
|
|
32
31
|
data['solar']['radiation'] = data_html.at_xpath('//input[@name="solarrad"]').attr('value').to_f
|
33
32
|
data['solar']['uv'] = data_html.at_xpath('//input[@name="uv"]').attr('value').to_f
|
34
33
|
data['solar']['uvi'] = data_html.at_xpath('//input[@name="uvi"]').attr('value').to_f
|
35
|
-
data['
|
36
|
-
data['
|
37
|
-
data['
|
38
|
-
data['
|
39
|
-
data['
|
40
|
-
data['
|
34
|
+
data['rainfall'] = {}
|
35
|
+
data['rainfall']['hourly'] = data_html.at_xpath('//input[@name="rainofhourly"]').attr('value').to_f
|
36
|
+
data['rainfall']['daily'] = data_html.at_xpath('//input[@name="rainofhourly"]').attr('value').to_f
|
37
|
+
data['rainfall']['weekly'] = data_html.at_xpath('//input[@name="rainofhourly"]').attr('value').to_f
|
38
|
+
data['rainfall']['monthly'] = data_html.at_xpath('//input[@name="rainofhourly"]').attr('value').to_f
|
39
|
+
data['rainfall']['yearly'] = data_html.at_xpath('//input[@name="rainofhourly"]').attr('value').to_f
|
41
40
|
return data
|
42
41
|
end
|
43
42
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wh2600
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Krunoslav Husak
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|