saal 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/saal_envoy_read +6 -5
- data/lib/envoy.rb +9 -6
- data/lib/saal.rb +1 -1
- data/lib/sensors.rb +8 -2
- data/saal.gemspec +3 -2
- 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: a8e07d635b3ad4c944de3ccbe81096f826754aa457b9ebf06854f01a760d715d
|
4
|
+
data.tar.gz: 766a7168fa122a72b388b6547b1f6b9531cd4afd5bc1df9df52673b9fd8291ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ada5f05af261f043ef3e871c21d61b3f1924b4b99d8059233f1202a8594c30ea9af425e3f62d75050ee2f6c8bc15782c1535e4fc4696c277d7619c0569e40dc
|
7
|
+
data.tar.gz: 39ece8cad43590608d9410d7ffdcab1449e1fcc309f123343ffa6872dd84b820a59635a0f3a1aaf5807d05e111394674aa1aa49d9dcc2589930477d5f3c10426
|
data/bin/saal_envoy_read
CHANGED
@@ -130,14 +130,15 @@ envoy = SAAL::Envoy::Inverters::new(
|
|
130
130
|
:host => ARGV[0],
|
131
131
|
:user => ARGV[1],
|
132
132
|
:password => ARGV[2],
|
133
|
+
:types => ["w_now", "last_report_date", "w_max"],
|
133
134
|
)
|
134
135
|
envoy.set_all_inverters!
|
135
136
|
inverters = envoy.create_sensors
|
136
|
-
puts "Found #{envoy.inverters.size} inverters"
|
137
|
+
puts " Found #{envoy.inverters.size} inverters"
|
137
138
|
envoy.inverters.each do |serial|
|
138
|
-
puts "INVERTER: #{serial} \
|
139
|
-
date:#{l(inverters,"
|
140
|
-
lastWatts:#{l(inverters,"
|
141
|
-
maxWatts:#{l(inverters,"
|
139
|
+
puts " INVERTER: #{serial} \
|
140
|
+
date:#{l(inverters,"inverters_#{serial}_last_report_date")} \
|
141
|
+
lastWatts:#{l(inverters,"inverters_#{serial}_w_now")} \
|
142
|
+
maxWatts:#{l(inverters,"inverters_#{serial}_w_max")} \
|
142
143
|
"
|
143
144
|
end
|
data/lib/envoy.rb
CHANGED
@@ -216,9 +216,10 @@ module SAAL
|
|
216
216
|
DEFAULT_TIMEOUT = 2
|
217
217
|
DEFAULT_CACHE_TIMEOUT = 50
|
218
218
|
DEFAULT_SOURCES = []
|
219
|
-
DEFAULT_TYPES = ["
|
219
|
+
DEFAULT_TYPES = ["w_now"] # "last_report_date", "w_max"
|
220
220
|
DEFAULT_USER = nil
|
221
221
|
DEFAULT_PASSWORD = nil
|
222
|
+
DEFAULT_PREFIX = "inverters"
|
222
223
|
attr_reader :inverters
|
223
224
|
|
224
225
|
def initialize(defs, opts={})
|
@@ -232,6 +233,7 @@ module SAAL
|
|
232
233
|
@inverters_list = {}
|
233
234
|
@inverters = defs[:inverters] || defs['inverters'] || DEFAULT_SOURCES
|
234
235
|
@types = defs[:types] || defs['types'] || DEFAULT_TYPES
|
236
|
+
@prefix = defs[:prefix] || defs['prefix'] || DEFAULT_PREFIX
|
235
237
|
end
|
236
238
|
|
237
239
|
def read_val(name)
|
@@ -254,7 +256,7 @@ module SAAL
|
|
254
256
|
def create_sensors
|
255
257
|
sensors = {}
|
256
258
|
@inverters.product(@types).each do |source, type|
|
257
|
-
key = "
|
259
|
+
key = "#{@prefix}_#{source}_#{type}"
|
258
260
|
sensors[key] = InverterUnderlying.new(key, self)
|
259
261
|
end
|
260
262
|
sensors
|
@@ -268,12 +270,13 @@ module SAAL
|
|
268
270
|
values = JSON.parse(response.body)
|
269
271
|
inverters = {}
|
270
272
|
values.each do |inverter|
|
273
|
+
serial = inverter["serialNumber"]
|
274
|
+
@inverters_list[serial] = true
|
271
275
|
{"lastReportDate" => "last_report_date",
|
272
|
-
"lastReportWatts" => "
|
273
|
-
"maxReportWatts" => "
|
276
|
+
"lastReportWatts" => "w_now",
|
277
|
+
"maxReportWatts" => "w_max",
|
274
278
|
}.each do |type, label|
|
275
|
-
inverters["
|
276
|
-
@inverters_list[inverter["serialNumber"]] = true
|
279
|
+
inverters["#{@prefix}_#{serial}_#{label}"] = inverter[type]
|
277
280
|
end
|
278
281
|
end
|
279
282
|
|
data/lib/saal.rb
CHANGED
data/lib/sensors.rb
CHANGED
@@ -54,9 +54,15 @@ module SAAL
|
|
54
54
|
return sensors.map do |name, underlying|
|
55
55
|
Sensor.new(dbstore, name, underlying, defs, opts)
|
56
56
|
end
|
57
|
+
elsif defs['envoy_inverters']
|
58
|
+
defs = defs['envoy_inverters'].merge('prefix' => name)
|
59
|
+
pe = SAAL::Envoy::Inverters::new(defs)
|
60
|
+
sensors = pe.create_sensors
|
61
|
+
return sensors.map do |name, underlying|
|
62
|
+
Sensor.new(dbstore, name, underlying, defs, opts)
|
63
|
+
end
|
57
64
|
else
|
58
|
-
|
59
|
-
raise UnknownSensorType, "Couldn't figure out a valid sensor type for #{name}"
|
65
|
+
$stderror.puts "WARNING: Couldn't figure out a valid sensor type for #{name}"
|
60
66
|
end
|
61
67
|
end
|
62
68
|
end
|
data/saal.gemspec
CHANGED
@@ -6,8 +6,8 @@ Gem::Specification.new do |s|
|
|
6
6
|
s.platform = Gem::Platform::RUBY
|
7
7
|
|
8
8
|
s.name = 'saal'
|
9
|
-
s.version = '0.3.
|
10
|
-
s.date = '2020-12-
|
9
|
+
s.version = '0.3.2'
|
10
|
+
s.date = '2020-12-25'
|
11
11
|
|
12
12
|
s.summary = "Thin abstraction layer for interfacing and recording sensors (currently onewire) and actuators (currently dinrelay)"
|
13
13
|
s.description = <<EOF
|
@@ -46,6 +46,7 @@ EOF
|
|
46
46
|
bin/saal_chart
|
47
47
|
bin/saal_daemon
|
48
48
|
bin/saal_dump_database
|
49
|
+
bin/saal_envoy_generate_config
|
49
50
|
bin/saal_envoy_read
|
50
51
|
bin/saal_import_mysql
|
51
52
|
bin/saal_readall
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: saal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pedro Côrte-Real
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-12-
|
11
|
+
date: 2020-12-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ownet
|