wh2600 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/wh2600.rb +8 -9
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 82cfe0f175d0f030dde4178008d31a0a4defd4c1
4
- data.tar.gz: 7da0532dad68d130740e5d1b1c1998c40c7cd66e
3
+ metadata.gz: 89e331e701c722c90a6ee0c3e60b7c466f1de641
4
+ data.tar.gz: 567152cb95ae18bb101b99e1b20f4c736c6ea778
5
5
  SHA512:
6
- metadata.gz: 96faaa5016d449da7e79287d14660a400ec0acff62a30fd2ff0798c9ba25a03911595146875fcc0ea198138cc2af46a2c9e7f9f83b827b26081b33acc738f4cd
7
- data.tar.gz: 8fc6eb3186896b42adb8af2e32129dc3a2696945f0458b7db5a2e40938acbf596c9af592ce4035687b00e1fa1359c97fdec728a9db4ff1063547e29237ced9a9
6
+ metadata.gz: 77bf8ea79446ce9a66686bfff4272132eb68e7de3caee4c25101f9f1c9cac99dd0e95dd92f6470851210f87cb5f8e31866a804aad358e35ce44247881a77987a
7
+ data.tar.gz: a73c1827350b8e667ce8c807157ff0a8143471489b905af087e6b5cbcb8d975b35f6297520c99e967bff970f7af8d0ae993f18b0f103b0bef11fc90005c6f1bc
@@ -2,15 +2,14 @@ require 'nokogiri'
2
2
  require 'open-uri'
3
3
 
4
4
  class Wh2600
5
- def initialize(ip_address, time_zone='CET')
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['receiver_datetime'] = DateTime.strptime(data_html.at_xpath('//input[@name="CurrTime"]')['value'] << @time_zone , '%H:%M %m/%d/%Y%Z')
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['rain'] = {}
36
- data['rain']['hourly'] = data_html.at_xpath('//input[@name="rainofhourly"]').attr('value').to_f
37
- data['rain']['daily'] = data_html.at_xpath('//input[@name="rainofhourly"]').attr('value').to_f
38
- data['rain']['weekly'] = data_html.at_xpath('//input[@name="rainofhourly"]').attr('value').to_f
39
- data['rain']['monthly'] = data_html.at_xpath('//input[@name="rainofhourly"]').attr('value').to_f
40
- data['rain']['yearly'] = data_html.at_xpath('//input[@name="rainofhourly"]').attr('value').to_f
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.1.1
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-17 00:00:00.000000000 Z
11
+ date: 2016-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri