senec 0.2.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/push.yml +23 -0
- data/.rubocop.yml +6 -104
- data/Gemfile +6 -3
- data/LICENSE.txt +1 -1
- data/README.md +12 -2
- data/lib/senec/constants.rb +28 -36
- data/lib/senec/request.rb +16 -0
- data/lib/senec/value.rb +1 -4
- data/lib/senec/version.rb +1 -1
- data/lib/senec.rb +0 -1
- data/senec.gemspec +5 -4
- metadata +10 -9
- data/.travis.yml +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16c3c9c4abc76f4aefff00ebf5d5bec743f32f6a974c82ad28687067177f38b9
|
4
|
+
data.tar.gz: e1688029cc73db36e58212956fb483697036159e45fd5e76082efe85d42c444f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c25862ac9c3ff78553ac5b651335c2ad653bbbc1746aa0164cdac8e67e65984104e0b453069cd4222f1a1bb188ffc1115cf41d7e1e21628dbd70aee7735cfb72
|
7
|
+
data.tar.gz: 9b0a3e4a5586ccdec41978614364951a3f616287dd8ed029ca66b707987656a45930d7688029cd1e705e9fd51833a4ec62bd9dea432c77bf26118e0676eecaec
|
@@ -0,0 +1,23 @@
|
|
1
|
+
name: Continuous integration
|
2
|
+
|
3
|
+
on: push
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
test:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
|
9
|
+
steps:
|
10
|
+
- name: Checkout the code
|
11
|
+
uses: actions/checkout@v2
|
12
|
+
|
13
|
+
- name: Set up Ruby
|
14
|
+
uses: ruby/setup-ruby@v1
|
15
|
+
with:
|
16
|
+
bundler-cache: true
|
17
|
+
ruby-version: '3.1'
|
18
|
+
|
19
|
+
- name: Lint with RuboCop
|
20
|
+
run: bundle exec rubocop
|
21
|
+
|
22
|
+
- name: Run tests
|
23
|
+
run: bundle exec rake
|
data/.rubocop.yml
CHANGED
@@ -1,115 +1,17 @@
|
|
1
1
|
require:
|
2
2
|
- rubocop-performance
|
3
3
|
- rubocop-rspec
|
4
|
+
- rubocop-rake
|
4
5
|
|
5
6
|
AllCops:
|
6
|
-
TargetRubyVersion: 2.
|
7
|
-
|
8
|
-
|
9
|
-
### Metrics
|
10
|
-
|
11
|
-
Metrics/MethodLength:
|
12
|
-
Max: 20
|
13
|
-
|
14
|
-
### Bundler
|
15
|
-
|
16
|
-
Bundler/OrderedGems:
|
17
|
-
Enabled: false
|
18
|
-
|
19
|
-
### Style
|
20
|
-
|
21
|
-
Style/FrozenStringLiteralComment:
|
22
|
-
Enabled: false
|
23
|
-
|
24
|
-
Style/SymbolArray:
|
25
|
-
EnforcedStyle: brackets
|
26
|
-
|
27
|
-
Style/MixinUsage:
|
28
|
-
Enabled: false
|
7
|
+
TargetRubyVersion: 2.6
|
8
|
+
NewCops: enable
|
29
9
|
|
30
10
|
Style/Documentation:
|
31
11
|
Enabled: false
|
32
12
|
|
33
|
-
Style/
|
34
|
-
Enabled: false
|
35
|
-
|
36
|
-
Style/Lambda:
|
37
|
-
EnforcedStyle: literal
|
38
|
-
|
39
|
-
Style/LambdaCall:
|
40
|
-
Enabled: false
|
41
|
-
|
42
|
-
Style/MethodCallWithArgsParentheses:
|
43
|
-
Enabled: false
|
44
|
-
|
45
|
-
Style/MissingElse:
|
46
|
-
Enabled: false
|
47
|
-
|
48
|
-
Style/Copyright:
|
49
|
-
Enabled: false
|
50
|
-
|
51
|
-
Style/InlineComment:
|
52
|
-
Enabled: false
|
53
|
-
|
54
|
-
Style/StringHashKeys:
|
55
|
-
Enabled: false
|
56
|
-
|
57
|
-
Style/MethodCalledOnDoEndBlock:
|
58
|
-
Enabled: false
|
59
|
-
|
60
|
-
Style/DocumentationMethod:
|
61
|
-
Enabled: false
|
62
|
-
|
63
|
-
Style/DisableCopsWithinSourceCodeDirective:
|
64
|
-
Enabled: false
|
65
|
-
|
66
|
-
Style/ConstantVisibility:
|
67
|
-
Enabled: false
|
68
|
-
|
69
|
-
### Layout
|
70
|
-
|
71
|
-
Layout/DotPosition:
|
72
|
-
EnforcedStyle: trailing
|
73
|
-
|
74
|
-
Layout/EndAlignment:
|
75
|
-
EnforcedStyleAlignWith: variable
|
76
|
-
|
77
|
-
Layout/SpaceInsideArrayLiteralBrackets:
|
78
|
-
Enabled: false
|
79
|
-
|
80
|
-
Layout/HashAlignment:
|
81
|
-
Enabled: false
|
82
|
-
|
83
|
-
Layout/MultilineMethodArgumentLineBreaks:
|
84
|
-
Enabled: false
|
85
|
-
|
86
|
-
Layout/MultilineArrayLineBreaks:
|
87
|
-
Enabled: false
|
88
|
-
|
89
|
-
Layout/MultilineAssignmentLayout:
|
90
|
-
Enabled: false
|
91
|
-
|
92
|
-
# RSpec
|
93
|
-
|
94
|
-
RSpec/MultipleExpectations:
|
95
|
-
Enabled: false
|
96
|
-
|
97
|
-
RSpec/AlignRightLetBrace:
|
98
|
-
Enabled: false
|
99
|
-
|
100
|
-
RSpec/MultipleDescribes:
|
101
|
-
Enabled: false
|
102
|
-
|
103
|
-
RSpec/NestedGroups:
|
104
|
-
Enabled: false
|
105
|
-
|
106
|
-
RSpec/ImplicitSubject:
|
107
|
-
Enabled: false
|
108
|
-
|
109
|
-
# Lint
|
110
|
-
|
111
|
-
Lint/ConstantResolution:
|
13
|
+
Style/FrozenStringLiteralComment:
|
112
14
|
Enabled: false
|
113
15
|
|
114
|
-
|
115
|
-
|
16
|
+
Metrics/MethodLength:
|
17
|
+
Max: 15
|
data/Gemfile
CHANGED
@@ -9,11 +9,14 @@ gem 'rake'
|
|
9
9
|
# rspec-3.10.0 (http://github.com/rspec)
|
10
10
|
gem 'rspec'
|
11
11
|
|
12
|
-
# Automatic Ruby code style checking tool. (https://github.com/rubocop
|
12
|
+
# Automatic Ruby code style checking tool. (https://github.com/rubocop/rubocop)
|
13
13
|
gem 'rubocop'
|
14
14
|
|
15
|
-
# Automatic performance checking tool for Ruby code. (https://github.com/rubocop
|
15
|
+
# Automatic performance checking tool for Ruby code. (https://github.com/rubocop/rubocop-performance)
|
16
16
|
gem 'rubocop-performance'
|
17
17
|
|
18
|
-
# Code style checking for RSpec files (https://github.com/rubocop
|
18
|
+
# Code style checking for RSpec files (https://github.com/rubocop/rubocop-rspec)
|
19
19
|
gem 'rubocop-rspec'
|
20
|
+
|
21
|
+
# A RuboCop plugin for Rake (https://github.com/rubocop/rubocop-rake)
|
22
|
+
gem 'rubocop-rake'
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -31,8 +31,13 @@ puts "Battery fuel charge: #{request.bat_fuel_charge} %"
|
|
31
31
|
puts "Battery charge current: #{request.bat_charge_current} A"
|
32
32
|
puts "Battery voltage: #{request.bat_voltage} V"
|
33
33
|
puts "\n"
|
34
|
+
puts "Case temperature: #{request.case_temp} °C"
|
35
|
+
puts "\n"
|
36
|
+
puts "Wallbox charge power: [ #{request.wallbox_charge_power.join(',')} ] W"
|
37
|
+
puts "\n"
|
34
38
|
puts "Grid power: #{request.grid_power} W"
|
35
39
|
puts "Current state of the system: #{request.current_state}"
|
40
|
+
puts "Measure time: #{Time.at request.measure_time}"
|
36
41
|
|
37
42
|
# Example result:
|
38
43
|
#
|
@@ -44,8 +49,13 @@ puts "Current state of the system: #{request.current_state}"
|
|
44
49
|
# Battery charge current: 19.8 A
|
45
50
|
# Battery voltage: 49.2 V
|
46
51
|
#
|
52
|
+
# Case temperature: 31.3 °C
|
53
|
+
#
|
54
|
+
# Wallbox charge power: [ 8680, 0, 0, 0 ] W
|
55
|
+
#
|
47
56
|
# Grid power: 315 W
|
48
57
|
# Current state of the system: CHARGE
|
58
|
+
# Measure time: 2021-10-06 17:50:22 +0200
|
49
59
|
```
|
50
60
|
|
51
61
|
## Development
|
@@ -56,7 +66,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
56
66
|
|
57
67
|
## Contributing
|
58
68
|
|
59
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
69
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/solectrus/senec. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/solectrus/senec/blob/master/CODE_OF_CONDUCT.md).
|
60
70
|
|
61
71
|
|
62
72
|
## License
|
@@ -65,4 +75,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
65
75
|
|
66
76
|
## Code of Conduct
|
67
77
|
|
68
|
-
Everyone interacting in this project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
78
|
+
Everyone interacting in this project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/solectrus/senec/blob/master/CODE_OF_CONDUCT.md).
|
data/lib/senec/constants.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
module Senec # rubocop:disable Metrics/ModuleLength
|
2
2
|
# Taken from https://github.com/mchwalisz/pysenec
|
3
3
|
STATE_NAMES = {
|
4
|
-
0
|
5
|
-
1
|
6
|
-
2
|
7
|
-
3
|
8
|
-
4
|
9
|
-
5
|
10
|
-
6
|
11
|
-
7
|
12
|
-
8
|
13
|
-
9
|
4
|
+
0 => 'INITIAL STATE',
|
5
|
+
1 => 'ERROR INVERTER COMMUNICATION',
|
6
|
+
2 => 'ERROR ELECTRICY METER',
|
7
|
+
3 => 'RIPPLE CONTROL RECEIVER',
|
8
|
+
4 => 'INITIAL CHARGE',
|
9
|
+
5 => 'MAINTENANCE CHARGE',
|
10
|
+
6 => 'MAINTENANCE READY',
|
11
|
+
7 => 'MAINTENANCE REQUIRED',
|
12
|
+
8 => 'MAN. SAFETY CHARGE',
|
13
|
+
9 => 'SAFETY CHARGE READY',
|
14
14
|
10 => 'FULL CHARGE',
|
15
15
|
11 => 'EQUALIZATION: CHARGE',
|
16
16
|
12 => 'DESULFATATION: CHARGE',
|
@@ -95,36 +95,28 @@ module Senec # rubocop:disable Metrics/ModuleLength
|
|
95
95
|
91 => 'EARTH FAULT'
|
96
96
|
}.freeze
|
97
97
|
|
98
|
-
#
|
98
|
+
# For a full list of available vars, see http://[IP-of-your-SENEC]/vars.html
|
99
|
+
# Comments taken from https://gist.github.com/smashnet/82ad0b9d7f0ba2e5098e6649ba08f88a
|
99
100
|
BASIC_REQUEST = {
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
'LIVE_BAT_DISCHARGE_MASTER': '', # Battery discharge amount since installation (kWh)
|
104
|
-
'LIVE_GRID_EXPORT': '', # Grid export amount since installation (kWh)
|
105
|
-
'LIVE_GRID_IMPORT': '', # Grid import amount since installation (kWh)
|
106
|
-
'LIVE_HOUSE_CONS': '', # House consumption since installation (kWh)
|
107
|
-
'LIVE_PV_GEN': '', # PV generated power since installation (kWh)
|
108
|
-
'MEASURE_TIME': '' # Unix timestamp for above values (ms)
|
101
|
+
STATISTIC: {
|
102
|
+
CURRENT_STATE: '', # Current state of the system (int, see SYSTEM_STATE_NAME)
|
103
|
+
MEASURE_TIME: '' # Unix timestamp for above values (ms)
|
109
104
|
},
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
105
|
+
ENERGY: {
|
106
|
+
GUI_BAT_DATA_CURRENT: '', # Battery charge current: negative if discharging, positiv if charging (A)
|
107
|
+
GUI_BAT_DATA_FUEL_CHARGE: '', # Remaining battery (percent)
|
108
|
+
GUI_BAT_DATA_POWER: '', # Battery charge power: negative if discharging, positiv if charging (W)
|
109
|
+
GUI_BAT_DATA_VOLTAGE: '', # Battery voltage (V)
|
110
|
+
GUI_GRID_POW: '', # Grid power: negative if exporting, positiv if importing (W)
|
111
|
+
GUI_HOUSE_POW: '', # House power consumption (W)
|
112
|
+
GUI_INVERTER_POWER: '', # PV production (W)
|
113
|
+
STAT_HOURS_OF_OPERATION: '' # Appliance hours of operation
|
119
114
|
},
|
120
|
-
|
121
|
-
|
122
|
-
'DISCHARGED_ENERGY': '', # List: Discharged energy per battery
|
123
|
-
'CYCLES': '' # List: Cycles per battery
|
115
|
+
TEMPMEASURE: {
|
116
|
+
CASE_TEMP: ''
|
124
117
|
},
|
125
|
-
|
126
|
-
|
127
|
-
'P_TOTAL': '' # ?
|
118
|
+
WALLBOX: {
|
119
|
+
APPARENT_CHARGING_POWER: ''
|
128
120
|
}
|
129
121
|
}.freeze
|
130
122
|
end
|
data/lib/senec/request.rb
CHANGED
@@ -44,6 +44,17 @@ module Senec
|
|
44
44
|
Senec::Value.new(value).to_i
|
45
45
|
end
|
46
46
|
|
47
|
+
def wallbox_charge_power
|
48
|
+
response.dig('WALLBOX', 'APPARENT_CHARGING_POWER').map do |value|
|
49
|
+
Senec::Value.new(value).to_i
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def case_temp
|
54
|
+
value = response.dig('TEMPMEASURE', 'CASE_TEMP')
|
55
|
+
Senec::Value.new(value).to_f
|
56
|
+
end
|
57
|
+
|
47
58
|
def current_state
|
48
59
|
value = response.dig('STATISTIC', 'CURRENT_STATE')
|
49
60
|
state = Senec::Value.new(value).to_i
|
@@ -51,6 +62,11 @@ module Senec
|
|
51
62
|
STATE_NAMES[state]
|
52
63
|
end
|
53
64
|
|
65
|
+
def measure_time
|
66
|
+
value = response.dig('STATISTIC', 'MEASURE_TIME')
|
67
|
+
Senec::Value.new(value).to_i
|
68
|
+
end
|
69
|
+
|
54
70
|
private
|
55
71
|
|
56
72
|
def response
|
data/lib/senec/value.rb
CHANGED
data/lib/senec/version.rb
CHANGED
data/lib/senec.rb
CHANGED
data/senec.gemspec
CHANGED
@@ -8,13 +8,14 @@ Gem::Specification.new do |spec|
|
|
8
8
|
|
9
9
|
spec.summary = 'Unofficial Ruby Client for SENEC Home'
|
10
10
|
spec.description = 'Access your local SENEC Solar Battery Storage System'
|
11
|
-
spec.homepage = 'https://github.com/
|
11
|
+
spec.homepage = 'https://github.com/solectrus/senec'
|
12
12
|
spec.license = 'MIT'
|
13
|
-
spec.required_ruby_version = Gem::Requirement.new('>= 2.
|
13
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.6.0')
|
14
14
|
|
15
15
|
spec.metadata['homepage_uri'] = spec.homepage
|
16
|
-
spec.metadata['source_code_uri'] = 'https://github.com/
|
17
|
-
spec.metadata['changelog_uri'] = 'https://github.com/
|
16
|
+
spec.metadata['source_code_uri'] = 'https://github.com/solectrus/senec'
|
17
|
+
spec.metadata['changelog_uri'] = 'https://github.com/solectrus/senec/releases'
|
18
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
18
19
|
|
19
20
|
# Specify which files should be added to the gem when it is released.
|
20
21
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: senec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Georg Ledermann
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Access your local SENEC Solar Battery Storage System
|
14
14
|
email:
|
@@ -17,10 +17,10 @@ executables: []
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
+
- ".github/workflows/push.yml"
|
20
21
|
- ".gitignore"
|
21
22
|
- ".rspec"
|
22
23
|
- ".rubocop.yml"
|
23
|
-
- ".travis.yml"
|
24
24
|
- CODE_OF_CONDUCT.md
|
25
25
|
- Gemfile
|
26
26
|
- LICENSE.txt
|
@@ -34,13 +34,14 @@ files:
|
|
34
34
|
- lib/senec/value.rb
|
35
35
|
- lib/senec/version.rb
|
36
36
|
- senec.gemspec
|
37
|
-
homepage: https://github.com/
|
37
|
+
homepage: https://github.com/solectrus/senec
|
38
38
|
licenses:
|
39
39
|
- MIT
|
40
40
|
metadata:
|
41
|
-
homepage_uri: https://github.com/
|
42
|
-
source_code_uri: https://github.com/
|
43
|
-
changelog_uri: https://github.com/
|
41
|
+
homepage_uri: https://github.com/solectrus/senec
|
42
|
+
source_code_uri: https://github.com/solectrus/senec
|
43
|
+
changelog_uri: https://github.com/solectrus/senec/releases
|
44
|
+
rubygems_mfa_required: 'true'
|
44
45
|
post_install_message:
|
45
46
|
rdoc_options: []
|
46
47
|
require_paths:
|
@@ -49,14 +50,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
49
50
|
requirements:
|
50
51
|
- - ">="
|
51
52
|
- !ruby/object:Gem::Version
|
52
|
-
version: 2.
|
53
|
+
version: 2.6.0
|
53
54
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
55
|
requirements:
|
55
56
|
- - ">="
|
56
57
|
- !ruby/object:Gem::Version
|
57
58
|
version: '0'
|
58
59
|
requirements: []
|
59
|
-
rubygems_version: 3.
|
60
|
+
rubygems_version: 3.3.8
|
60
61
|
signing_key:
|
61
62
|
specification_version: 4
|
62
63
|
summary: Unofficial Ruby Client for SENEC Home
|