sunscout 0.1 → 0.2
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/lib/sunscout/solar_log.rb +1 -1
- data/lib/sunscout/solar_log/client.rb +1 -1
- data/lib/sunscout/solar_log/solar_log.rb +8 -3
- data/sunscout.gemspec +3 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 644c483147167e8f1ef8cdfb1523410f0f573db2
|
4
|
+
data.tar.gz: db5cd8d9fa95c7e639d8709462c6b384f30552c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 086a705e56e0537293fef631e8e7e363547b9b35864a86887d32bbe230ab612da11585b66e04bec7035cf3c5cd921720565381d62a970c33726132dd85613438
|
7
|
+
data.tar.gz: 800a75d24883102b32a6549235f685958c0040c59f4c0ca00cd5adcd9763b3fcdebdeddf8094ae62abcf706808b79a74e50d566166f5e8959317f7073439a4d7
|
data/lib/sunscout/solar_log.rb
CHANGED
@@ -15,7 +15,7 @@ module Sunscout
|
|
15
15
|
# require 'sunscout'
|
16
16
|
#
|
17
17
|
# puts 'Querying data from SolarLog API'
|
18
|
-
# solar_log = Sunscout::SolarLog::SolarLog.new('http://10.0.0.10')
|
18
|
+
# solar_log = Sunscout::SolarLog::SolarLog.new('http://10.0.0.10', timezone: '+0500')
|
19
19
|
#
|
20
20
|
# puts "Data from: #{ solar_log.time.iso8601 }"
|
21
21
|
# puts "AC Power: #{ solar_log.power_ac }W (DC Power: #{ solar_log.power_dc }W, #{ (solar_log.efficiency*100).round(0) }% efficiency, #{ solar_log.alternator_loss }W loss)"
|
@@ -7,7 +7,7 @@ module Sunscout
|
|
7
7
|
# High-level binding to the SolarLog HTTP API
|
8
8
|
# @example Basic usage
|
9
9
|
# require 'sunscout'
|
10
|
-
# sl = Sunscout::SolarLog::SolarLog.new('http://10.60.1.10')
|
10
|
+
# sl = Sunscout::SolarLog::SolarLog.new('http://10.60.1.10', timezone: 'CEST')
|
11
11
|
# puts "AC power: #{ sl.power_ac }W (DC: #{ sl.power_dc }W, Efficiency #{ (sl.efficiency*100).round(0) }%)"
|
12
12
|
# puts "Remaining power: #{ sl.power_available }W"
|
13
13
|
class SolarLog
|
@@ -72,11 +72,16 @@ module Sunscout
|
|
72
72
|
# This also immediately queries data from the SolarLog API.
|
73
73
|
#
|
74
74
|
# @param host [String] URI of the SolarLog web interface
|
75
|
-
|
75
|
+
# @param timezone [String] Timezone (or offset) which the SolarLog station resides in.
|
76
|
+
# If none is specified, assume UTC.
|
77
|
+
def initialize(host, timezone: '+0000')
|
76
78
|
client = Sunscout::SolarLog::Client.new(host)
|
77
79
|
data = client.get_data
|
78
80
|
|
79
|
-
|
81
|
+
# SolarLog returns the time a) without a timezone indicator and b) as whatever the station is configured.
|
82
|
+
# Hence, the user has to specify what timezone it is in - otherwise we'll just fall back to UTC.
|
83
|
+
time = "#{ data.fetch(:time) } #{ timezone }"
|
84
|
+
@time = DateTime.strptime(time, '%d.%m.%y %H:%M:%s %Z')
|
80
85
|
|
81
86
|
@power_ac = data.fetch :power_ac
|
82
87
|
@power_dc = data.fetch :power_dc
|
data/sunscout.gemspec
CHANGED
@@ -4,13 +4,13 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "sunscout"
|
7
|
-
spec.version = '0.
|
7
|
+
spec.version = '0.2'
|
8
8
|
spec.authors = ["Michael Senn"]
|
9
9
|
spec.email = ["michael@morrolan.ch"]
|
10
10
|
|
11
11
|
spec.summary = %q{Binding to Solarlog HTTP API}
|
12
12
|
# spec.description = %q{}
|
13
|
-
|
13
|
+
spec.homepage = "https://bitbucket.org/Lavode/sunscout"
|
14
14
|
spec.license = "Apache-2.0"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
@@ -23,3 +23,4 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_development_dependency "rspec", "~> 3.0"
|
24
24
|
spec.add_development_dependency "yard"
|
25
25
|
end
|
26
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sunscout
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Senn
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -87,7 +87,7 @@ files:
|
|
87
87
|
- lib/sunscout/solar_log/client.rb
|
88
88
|
- lib/sunscout/solar_log/solar_log.rb
|
89
89
|
- sunscout.gemspec
|
90
|
-
homepage:
|
90
|
+
homepage: https://bitbucket.org/Lavode/sunscout
|
91
91
|
licenses:
|
92
92
|
- Apache-2.0
|
93
93
|
metadata: {}
|