senec 0.17.2 → 0.18.0
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/LICENSE +1 -1
- data/README.md +32 -3
- data/lib/senec/cloud/dashboard.rb +23 -12
- data/lib/senec/version.rb +1 -1
- metadata +3 -12
- data/.github/workflows/push.yml +0 -37
- data/.gitignore +0 -13
- data/Gemfile +0 -43
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/senec.gemspec +0 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6af14cd79b5176290de5c80e492c31a4e0891770b720fd5017b2b830898838b
|
4
|
+
data.tar.gz: 59477e8b56dea17973fa2e1e7e05e4266d67172f9be54375c120fdd2bbca885a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19c4f8ae182ef21edaf0e07d62fda3ad45640ac43018c19af26dd125b34987981497f6adade28dcf31e873566fff63f82e5a83639813a1406a8fc0831c81fc8f
|
7
|
+
data.tar.gz: 3bac421adcf8eca7f5f07bdf4ef2a4a5deba0515058cb630f9797cf3c0b64c674123685ba4441c7c0404b097961872a0a730d1d1a5165003c217bbd85ee8912d
|
data/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
MIT License
|
2
2
|
|
3
|
-
Copyright (c) 2020-
|
3
|
+
Copyright (c) 2020-2025 Georg Ledermann <georg@ledermann.dev>
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
@@ -69,14 +69,43 @@ puts Senec::Cloud::Dashboard[connection].find("123456").data
|
|
69
69
|
# {"stromerzeugung"=>{"wert"=>0.01, "einheit"=>"W"},
|
70
70
|
# ....
|
71
71
|
|
72
|
-
#
|
72
|
+
# Dashboard data can be requested in different versions, v1 and v2 are available, v1 is the default.
|
73
|
+
# To request the data in version 2, pass the version parameter to the `data` method:
|
74
|
+
puts Senec::Cloud::Dashboard[connection].first.data(version: 'v2')
|
75
|
+
|
76
|
+
# => {
|
77
|
+
# 'currently' => {
|
78
|
+
# 'powerGenerationInW' => 1.0e-05,
|
79
|
+
# 'powerConsumptionInW' => 1350.37,
|
80
|
+
# 'gridFeedInInW' => 1.0e-05,
|
81
|
+
# 'gridDrawInW' => 1321.26966059603,
|
82
|
+
# 'batteryChargeInW' => 1.0e-05,
|
83
|
+
# 'batteryDischargeInW' => 11.6411423841,
|
84
|
+
# 'batteryLevelInPercent' => 1.0e-05,
|
85
|
+
# 'selfSufficiencyInPercent' => 2.16,
|
86
|
+
# 'wallboxInW' => 1.0e-05
|
87
|
+
# },
|
88
|
+
# 'today' => {
|
89
|
+
# 'powerGenerationInWh' => 3.90625,
|
90
|
+
# 'powerConsumptionInWh' => 9119.14,
|
91
|
+
# 'gridFeedInInWh' => 0.0,
|
92
|
+
# 'gridDrawInWh' => 9011.71875,
|
93
|
+
# 'batteryChargeInWh' => 0.0,
|
94
|
+
# 'batteryDischargeInWh' => 107.421875,
|
95
|
+
# 'batteryLevelInPercent' => 1.0e-05,
|
96
|
+
# 'selfSufficiencyInPercent' => 1.18,
|
97
|
+
# 'wallboxInWh' => 0.0
|
98
|
+
# },
|
99
|
+
# 'timestamp' => '2025-01-11T06:45:09Z',
|
100
|
+
# 'electricVehicleConnected' => false
|
101
|
+
# }
|
73
102
|
|
103
|
+
# Get the Technical Data of a specific system (by ID):
|
74
104
|
puts Senec::Cloud::TechnicalData[connection].find("123456").data
|
75
105
|
|
76
106
|
# => {"systemOverview"=>{"systemId"=>123456, "productName"=>"SENEC.Home V3 hybrid duo", ...
|
77
107
|
|
78
108
|
# Get the Technical Data of first systems (without knowing the ID):
|
79
|
-
|
80
109
|
puts Senec::Cloud::TechnicalData[connection].first.data
|
81
110
|
|
82
111
|
# => {"systemOverview"=>{"systemId"=>123456, "productName"=>"SENEC.Home V3 hybrid duo", ...
|
@@ -153,7 +182,7 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/solect
|
|
153
182
|
|
154
183
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
155
184
|
|
156
|
-
Copyright (c) 2020-
|
185
|
+
Copyright (c) 2020-2025 Georg Ledermann
|
157
186
|
|
158
187
|
## Code of Conduct
|
159
188
|
|
@@ -7,14 +7,23 @@ require_relative 'connection'
|
|
7
7
|
# connection = Senec::Cloud::Connection.new(username: '...', password: '...')
|
8
8
|
#
|
9
9
|
# # Get the data of a specific system:
|
10
|
-
# Dashboard[connection].find('123456')
|
10
|
+
# Dashboard[connection].find('123456').data
|
11
11
|
#
|
12
12
|
# # Get the data of the default system:
|
13
|
-
# Dashboard[connection].first
|
13
|
+
# Dashboard[connection].first.data
|
14
|
+
#
|
15
|
+
# By default, it returns v1 data. To get v2 data, use:
|
16
|
+
#
|
17
|
+
# Dashboard[connection].find('123456').data(version: 'v2')
|
18
|
+
# or
|
19
|
+
# Dashboard[connection].first.data(version: 'v2')
|
14
20
|
#
|
15
21
|
module Senec
|
16
22
|
module Cloud
|
17
23
|
class Dashboard
|
24
|
+
AVAILABLE_VERSIONS = %w[v1 v2].freeze
|
25
|
+
DEFAULT_VERSION = 'v1'.freeze
|
26
|
+
|
18
27
|
class Finder
|
19
28
|
def initialize(connection)
|
20
29
|
@connection = connection
|
@@ -22,7 +31,7 @@ module Senec
|
|
22
31
|
attr_reader :connection
|
23
32
|
|
24
33
|
def find(system_id)
|
25
|
-
Dashboard.new(connection:, system_id:)
|
34
|
+
Dashboard.new(connection:, system_id:)
|
26
35
|
end
|
27
36
|
|
28
37
|
def first
|
@@ -41,17 +50,18 @@ module Senec
|
|
41
50
|
@system_id = system_id
|
42
51
|
|
43
52
|
# Useful for testing only
|
44
|
-
@data =
|
53
|
+
@data = {
|
54
|
+
'v1' => data,
|
55
|
+
'v2' => data
|
56
|
+
}
|
45
57
|
end
|
46
58
|
|
47
|
-
def
|
48
|
-
|
49
|
-
|
50
|
-
@system_id ||= connection.default_system_id
|
51
|
-
@data = fetch_data
|
59
|
+
def data(version: DEFAULT_VERSION)
|
60
|
+
@data ||= {}
|
61
|
+
@data[version] ||= fetch_data(version:)
|
52
62
|
end
|
53
63
|
|
54
|
-
attr_reader :system_id
|
64
|
+
attr_reader :system_id
|
55
65
|
|
56
66
|
private
|
57
67
|
|
@@ -59,10 +69,11 @@ module Senec
|
|
59
69
|
@connection.get(path, params:)
|
60
70
|
end
|
61
71
|
|
62
|
-
def fetch_data
|
72
|
+
def fetch_data(version:)
|
73
|
+
raise ArgumentError unless AVAILABLE_VERSIONS.include?(version)
|
63
74
|
return unless system_id
|
64
75
|
|
65
|
-
get("/
|
76
|
+
get("/#{version}/senec/systems/#{system_id}/dashboard")
|
66
77
|
end
|
67
78
|
end
|
68
79
|
end
|
data/lib/senec/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: senec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.18.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Georg Ledermann
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-01-11 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: faraday
|
@@ -60,18 +59,13 @@ extensions: []
|
|
60
59
|
extra_rdoc_files: []
|
61
60
|
files:
|
62
61
|
- ".env.test"
|
63
|
-
- ".github/workflows/push.yml"
|
64
|
-
- ".gitignore"
|
65
62
|
- ".rspec"
|
66
63
|
- ".rubocop.yml"
|
67
64
|
- ".vscode/settings.json"
|
68
65
|
- CODE_OF_CONDUCT.md
|
69
|
-
- Gemfile
|
70
66
|
- LICENSE
|
71
67
|
- README.md
|
72
68
|
- Rakefile
|
73
|
-
- bin/console
|
74
|
-
- bin/setup
|
75
69
|
- lib/senec.rb
|
76
70
|
- lib/senec/cloud/connection.rb
|
77
71
|
- lib/senec/cloud/dashboard.rb
|
@@ -84,7 +78,6 @@ files:
|
|
84
78
|
- lib/senec/local/state.rb
|
85
79
|
- lib/senec/local/value.rb
|
86
80
|
- lib/senec/version.rb
|
87
|
-
- senec.gemspec
|
88
81
|
homepage: https://github.com/solectrus/senec
|
89
82
|
licenses:
|
90
83
|
- MIT
|
@@ -93,7 +86,6 @@ metadata:
|
|
93
86
|
source_code_uri: https://github.com/solectrus/senec
|
94
87
|
changelog_uri: https://github.com/solectrus/senec/releases
|
95
88
|
rubygems_mfa_required: 'true'
|
96
|
-
post_install_message:
|
97
89
|
rdoc_options: []
|
98
90
|
require_paths:
|
99
91
|
- lib
|
@@ -108,8 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
100
|
- !ruby/object:Gem::Version
|
109
101
|
version: '0'
|
110
102
|
requirements: []
|
111
|
-
rubygems_version: 3.
|
112
|
-
signing_key:
|
103
|
+
rubygems_version: 3.6.2
|
113
104
|
specification_version: 4
|
114
105
|
summary: Unofficial Ruby Client for SENEC Home
|
115
106
|
test_files: []
|
data/.github/workflows/push.yml
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
name: Continuous integration
|
2
|
-
|
3
|
-
on: push
|
4
|
-
|
5
|
-
jobs:
|
6
|
-
test:
|
7
|
-
runs-on: ubuntu-latest
|
8
|
-
|
9
|
-
strategy:
|
10
|
-
fail-fast: false
|
11
|
-
matrix:
|
12
|
-
ruby: ['3.2', '3.3']
|
13
|
-
|
14
|
-
env:
|
15
|
-
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
16
|
-
|
17
|
-
steps:
|
18
|
-
- name: Checkout the code
|
19
|
-
uses: actions/checkout@v4
|
20
|
-
|
21
|
-
- name: Set up Ruby
|
22
|
-
uses: ruby/setup-ruby@v1
|
23
|
-
with:
|
24
|
-
bundler-cache: true
|
25
|
-
ruby-version: ${{ matrix.ruby }}
|
26
|
-
|
27
|
-
- name: Lint with RuboCop
|
28
|
-
run: bundle exec rubocop
|
29
|
-
|
30
|
-
- name: Run tests
|
31
|
-
run: bundle exec dotenv -f ".env.test" rspec
|
32
|
-
|
33
|
-
- name: Send test coverage to CodeClimate
|
34
|
-
uses: paambaati/codeclimate-action@v8
|
35
|
-
if: ${{ env.CC_TEST_REPORTER_ID }}
|
36
|
-
with:
|
37
|
-
coverageCommand: true
|
data/.gitignore
DELETED
data/Gemfile
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in senec.gemspec
|
4
|
-
gemspec
|
5
|
-
|
6
|
-
# Support for encoding and decoding binary data using a Base64 representation. (https://github.com/ruby/base64)
|
7
|
-
gem 'base64'
|
8
|
-
|
9
|
-
# Arbitrary-precision decimal floating-point number library. (https://github.com/ruby/bigdecimal)
|
10
|
-
gem 'bigdecimal'
|
11
|
-
|
12
|
-
# Rake is a Make-like program implemented in Ruby (https://github.com/ruby/rake)
|
13
|
-
gem 'rake'
|
14
|
-
|
15
|
-
# rspec-3.13.0 (http://github.com/rspec)
|
16
|
-
gem 'rspec'
|
17
|
-
|
18
|
-
# Automatic Ruby code style checking tool. (https://github.com/rubocop/rubocop)
|
19
|
-
gem 'rubocop', require: false
|
20
|
-
|
21
|
-
# Automatic performance checking tool for Ruby code. (https://github.com/rubocop/rubocop-performance)
|
22
|
-
gem 'rubocop-performance', require: false
|
23
|
-
|
24
|
-
# Code style checking for RSpec files (https://github.com/rubocop/rubocop-rspec)
|
25
|
-
gem 'rubocop-rspec', require: false
|
26
|
-
|
27
|
-
# A RuboCop plugin for Rake (https://github.com/rubocop/rubocop-rake)
|
28
|
-
gem 'rubocop-rake', require: false
|
29
|
-
|
30
|
-
# Thread-safety checks via static analysis (https://github.com/rubocop/rubocop-thread_safety)
|
31
|
-
gem 'rubocop-thread_safety', require: false
|
32
|
-
|
33
|
-
# Loads environment variables from `.env`. (https://github.com/bkeepers/dotenv)
|
34
|
-
gem 'dotenv'
|
35
|
-
|
36
|
-
# Record your test suite's HTTP interactions and replay them during future test runs for fast, deterministic, accurate tests. (https://benoittgt.github.io/vcr)
|
37
|
-
gem 'vcr'
|
38
|
-
|
39
|
-
# Code coverage for Ruby (https://github.com/simplecov-ruby/simplecov)
|
40
|
-
gem 'simplecov'
|
41
|
-
|
42
|
-
# Library for stubbing HTTP requests in Ruby. (https://github.com/bblimke/webmock)
|
43
|
-
gem 'webmock'
|
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'bundler/setup'
|
4
|
-
require 'senec'
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require 'irb'
|
14
|
-
IRB.start(__FILE__)
|
data/bin/setup
DELETED
data/senec.gemspec
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
require_relative 'lib/senec/version'
|
2
|
-
|
3
|
-
Gem::Specification.new do |spec|
|
4
|
-
spec.name = 'senec'
|
5
|
-
spec.version = Senec::VERSION
|
6
|
-
spec.authors = ['Georg Ledermann']
|
7
|
-
spec.email = ['georg@ledermann.dev']
|
8
|
-
|
9
|
-
spec.summary = 'Unofficial Ruby Client for SENEC Home'
|
10
|
-
spec.description = 'Access your local SENEC Solar Battery Storage System'
|
11
|
-
spec.homepage = 'https://github.com/solectrus/senec'
|
12
|
-
spec.license = 'MIT'
|
13
|
-
spec.required_ruby_version = Gem::Requirement.new('>= 3.2.0')
|
14
|
-
spec.add_dependency 'faraday'
|
15
|
-
spec.add_dependency 'faraday-net_http_persistent'
|
16
|
-
spec.add_dependency 'faraday-request-timer'
|
17
|
-
|
18
|
-
spec.metadata['homepage_uri'] = spec.homepage
|
19
|
-
spec.metadata['source_code_uri'] = 'https://github.com/solectrus/senec'
|
20
|
-
spec.metadata['changelog_uri'] = 'https://github.com/solectrus/senec/releases'
|
21
|
-
spec.metadata['rubygems_mfa_required'] = 'true'
|
22
|
-
|
23
|
-
# Specify which files should be added to the gem when it is released.
|
24
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
25
|
-
spec.files =
|
26
|
-
Dir.chdir(File.expand_path(__dir__)) do
|
27
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
28
|
-
end
|
29
|
-
spec.bindir = 'exe'
|
30
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
|
-
spec.require_paths = ['lib']
|
32
|
-
end
|