From 7b00bf29c5ef628a252abaafda0f8ddc885c9afd Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Sat, 3 Jul 2021 09:20:40 +0200 Subject: [PATCH 1/4] Add donation_mode * README.md: * exe/saj_collector: * exe/saj_output_collector: --- README.md | 4 ++++ exe/saj_collector | 5 +++-- exe/saj_output_collector | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 04b717a..e9b21c6 100644 --- a/README.md +++ b/README.md @@ -28,11 +28,15 @@ a granularity of 0.01kWh. In case of the last you have to change the ```day_tren within your ```saj_collector.yaml``` to 10. An incorrect ```day_trend_multiplication_factor``` triggers a `Bad Post` exception when running the `saj_output_collector` script. +At the moment you are a [PVOutput donator](https://pvoutput.org/donate.jsp) change ```donation_mode``` to +true to enable the donation features of PVOutput. + ``` yaml :saj: a.b.c.d :system_id: 123456 :api_key: fb6a2e3 :day_trend_multiplication_factor: 100 +:donation_mode: false ``` Run the SAJ Collector from the command prompt or shell diff --git a/exe/saj_collector b/exe/saj_collector index 29a3a12..c7c41e7 100755 --- a/exe/saj_collector +++ b/exe/saj_collector @@ -13,8 +13,9 @@ yaml_file = 'saj_collector.yaml' sajcollector_config = YAML.load_file(yaml_file) # Create a pvoutput with the configured system_id and api_key which both -# can be obtained from the pvoutput website -pvoutput = PVOutput::Client.new(sajcollector_config[:system_id], sajcollector_config[:api_key]) +# can be obtained from the pvoutput website. At the moment donation_mode +# has been specified batching can be used +pvoutput = PVOutput::Client.new(sajcollector_config[:system_id], sajcollector_config[:api_key], sajcollector_config[:donation_mode]) unless IPAddress.valid?(sajcollector_config[:saj]) raise("[#{sajcollector_config[:saj]}] is not a valid IP address, please correct your #{yaml_file} file") diff --git a/exe/saj_output_collector b/exe/saj_output_collector index 2ace405..d16dc5c 100755 --- a/exe/saj_output_collector +++ b/exe/saj_output_collector @@ -14,7 +14,7 @@ sajcollector_config = YAML.load_file(yaml_file) # Create a pvoutput with the configured system_id and api_key which both # can be obtained from the pvoutput website -pvoutput = PVOutput::Client.new(sajcollector_config[:system_id], sajcollector_config[:api_key]) +pvoutput = PVOutput::Client.new(sajcollector_config[:system_id], sajcollector_config[:api_key], sajcollector_config[:donation_mode]) unless IPAddress.valid?(sajcollector_config[:saj]) raise("[#{sajcollector_config[:saj]}] is not a valid IP address, please correct your #{yaml_file} file") From 4e9081bcd87918cd7f6f402f5ba748e1719dcb9e Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Sat, 3 Jul 2021 09:26:59 +0200 Subject: [PATCH 2/4] Fixed lint errors * exe/saj_collector: * exe/saj_output_collector: --- exe/saj_collector | 4 +++- exe/saj_output_collector | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/exe/saj_collector b/exe/saj_collector index c7c41e7..dccba47 100755 --- a/exe/saj_collector +++ b/exe/saj_collector @@ -15,7 +15,9 @@ sajcollector_config = YAML.load_file(yaml_file) # Create a pvoutput with the configured system_id and api_key which both # can be obtained from the pvoutput website. At the moment donation_mode # has been specified batching can be used -pvoutput = PVOutput::Client.new(sajcollector_config[:system_id], sajcollector_config[:api_key], sajcollector_config[:donation_mode]) +pvoutput = PVOutput::Client.new( + sajcollector_config[:system_id], sajcollector_config[:api_key], sajcollector_config[:donation_mode] +) unless IPAddress.valid?(sajcollector_config[:saj]) raise("[#{sajcollector_config[:saj]}] is not a valid IP address, please correct your #{yaml_file} file") diff --git a/exe/saj_output_collector b/exe/saj_output_collector index d16dc5c..c2f248f 100755 --- a/exe/saj_output_collector +++ b/exe/saj_output_collector @@ -13,8 +13,11 @@ yaml_file = 'saj_collector.yaml' sajcollector_config = YAML.load_file(yaml_file) # Create a pvoutput with the configured system_id and api_key which both -# can be obtained from the pvoutput website -pvoutput = PVOutput::Client.new(sajcollector_config[:system_id], sajcollector_config[:api_key], sajcollector_config[:donation_mode]) +# can be obtained from the pvoutput website. At the moment donation_mode +# has been specified batching can be used +pvoutput = PVOutput::Client.new( + sajcollector_config[:system_id], sajcollector_config[:api_key], sajcollector_config[:donation_mode] +) unless IPAddress.valid?(sajcollector_config[:saj]) raise("[#{sajcollector_config[:saj]}] is not a valid IP address, please correct your #{yaml_file} file") From f52628e0718bd2bf3181077871e04bcaadc2fc87 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Sat, 3 Jul 2021 09:28:28 +0200 Subject: [PATCH 3/4] Upgrade to v1.1.0 * lib/saj_collector/version.rb: --- lib/saj_collector/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/saj_collector/version.rb b/lib/saj_collector/version.rb index 7974f5d..d7f4668 100644 --- a/lib/saj_collector/version.rb +++ b/lib/saj_collector/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module SAJCollector - VERSION = '1.0.3' + VERSION = '1.1.0' end From f5e0dcabcbe2d66631994c031db6a66be479641c Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Sat, 3 Jul 2021 09:28:47 +0200 Subject: [PATCH 4/4] We require pvoutput > 1.0 because of pvoutput batchoutput changes * saj_collector.gemspec: --- saj_collector.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/saj_collector.gemspec b/saj_collector.gemspec index 942b03c..07f4ec6 100644 --- a/saj_collector.gemspec +++ b/saj_collector.gemspec @@ -22,7 +22,7 @@ Gem::Specification.new do |spec| spec.required_ruby_version = '>= 2.5' spec.add_dependency 'ipaddress' - spec.add_dependency 'pvoutput', '>= 1.0' + spec.add_dependency 'pvoutput', '> 1.0' spec.add_development_dependency 'bundler' spec.add_development_dependency 'rake', '>= 12.3.3'