senec 0.1.0 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1ca571cf19a300fc08c64d1c194ff240628850c4101ed3b6ce1957df09866ba5
4
- data.tar.gz: 98b56df0080489a641856988739776aea7f90120fc4ae1dd9c80c2bbe153f6a7
3
+ metadata.gz: e01c953be78bd25556bdc237430130f7dec23a0d48d6bf0ba345c4148f132e1e
4
+ data.tar.gz: 29d87125f60177f5110a7efe7d4016c1390fcb03362f37e914630359ad327989
5
5
  SHA512:
6
- metadata.gz: 8a6a7c00a1d5e199ed70b73341e389d52f63fe197ddf61098397726e278bf3b2140664ec8a1198289ee844e905a9b0fc5efe9ed770cf921bab21bbaadf0fe2fa
7
- data.tar.gz: d62d573bfcff7fa4613cadbf485052397e772cf03c7380aad9dea6d54134aee7b4e86afc2408fa0d68697f2bdac3b7c75580d7cbfacd2d40ab985500657ef435
6
+ metadata.gz: 2a0e8e2fdedc6c7189f53df01abc35bffc427ce561ac5f66f4e129bcd53242f58b4ccf499ec4560d465b939ec7f07482c755affc287a636dba7824ebd668288c
7
+ data.tar.gz: 35a99bb5c476a589186084a5a9055fa56f7d0d6731dcc8e2c576567387b40158423a30d10164ca84ddadd5df89f82cb4bed72d16d80bf9a17f9a52f989881525
data/.gitignore CHANGED
@@ -9,3 +9,4 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+ Gemfile.lock
data/README.md CHANGED
@@ -23,11 +23,29 @@ require 'senec'
23
23
 
24
24
  request = Senec::Request.new host: '10.0.1.99'
25
25
 
26
- puts "House power consumption: #{request.house_power} W"
27
26
  puts "PV production: #{request.inverter_power} W"
27
+ puts "House power consumption: #{request.house_power} W"
28
+ puts "\n"
28
29
  puts "Battery charge power: #{request.bat_power} W"
30
+ puts "Battery fuel charge: #{request.bat_fuel_charge} %"
31
+ puts "Battery charge current: #{request.bat_charge_current} A"
32
+ puts "Battery voltage: #{request.bat_voltage} V"
33
+ puts "\n"
29
34
  puts "Grid power: #{request.grid_power} W"
30
35
  puts "Current state of the system: #{request.current_state}"
36
+
37
+ # Example result:
38
+ #
39
+ # PV production: 1530 W
40
+ # House power consumption: 870 W
41
+ #
42
+ # Battery charge power: 974 W
43
+ # Battery fuel charge: 11.3 %
44
+ # Battery charge current: 19.8 A
45
+ # Battery voltage: 49.2 V
46
+ #
47
+ # Grid power: 315 W
48
+ # Current state of the system: CHARGE
31
49
  ```
32
50
 
33
51
  ## Development
@@ -47,4 +65,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
47
65
 
48
66
  ## Code of Conduct
49
67
 
50
- 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/[USERNAME]/senec/blob/master/CODE_OF_CONDUCT.md).
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/ledermann/senec/blob/master/CODE_OF_CONDUCT.md).
@@ -123,16 +123,8 @@ module Senec # rubocop:disable Metrics/ModuleLength
123
123
  'CYCLES': '' # List: Cycles per battery
124
124
  },
125
125
  'PV1': {
126
- 'MPP_CUR': '', # List: MPP current (A)
127
- 'MPP_POWER': '', # List: MPP power (W)
128
- 'MPP_VOL': '', # List: MPP voltage (V)
129
126
  'POWER_RATIO': '', # Grid export limit (percent)
130
127
  'P_TOTAL': '' # ?
131
- },
132
- 'FACTORY': {
133
- 'DESIGN_CAPACITY': '', # Battery design capacity (Wh)
134
- 'MAX_CHARGE_POWER_DC': '', # Battery max charging power (W)
135
- 'MAX_DISCHARGE_POWER_DC': '' # Battery max discharging power (W)
136
128
  }
137
129
  }.freeze
138
130
  end
@@ -24,6 +24,21 @@ module Senec
24
24
  Senec::Value.new(value).to_i
25
25
  end
26
26
 
27
+ def bat_fuel_charge
28
+ value = response.dig('ENERGY', 'GUI_BAT_DATA_FUEL_CHARGE')
29
+ Senec::Value.new(value).to_f
30
+ end
31
+
32
+ def bat_charge_current
33
+ value = response.dig('ENERGY', 'GUI_BAT_DATA_CURRENT')
34
+ Senec::Value.new(value).to_f
35
+ end
36
+
37
+ def bat_voltage
38
+ value = response.dig('ENERGY', 'GUI_BAT_DATA_VOLTAGE')
39
+ Senec::Value.new(value).to_f
40
+ end
41
+
27
42
  def grid_power
28
43
  value = response.dig('ENERGY', 'GUI_GRID_POW')
29
44
  Senec::Value.new(value).to_i
@@ -31,7 +31,10 @@ module Senec
31
31
  end
32
32
 
33
33
  def hex2float(hex)
34
- [ "0x#{hex}".to_i(16) ].pack('L').unpack1('F')
34
+ [ "0x#{hex}".to_i(16) ].
35
+ pack('L').
36
+ unpack1('F').
37
+ round(1)
35
38
  end
36
39
 
37
40
  def hex2int(hex)
@@ -1,3 +1,3 @@
1
1
  module Senec
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.2.0'.freeze
3
3
  end
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.1.0
4
+ version: 0.2.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: 2020-11-28 00:00:00.000000000 Z
11
+ date: 2020-12-22 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Access your local SENEC Solar Battery Storage System
14
14
  email:
@@ -23,7 +23,6 @@ files:
23
23
  - ".travis.yml"
24
24
  - CODE_OF_CONDUCT.md
25
25
  - Gemfile
26
- - Gemfile.lock
27
26
  - LICENSE.txt
28
27
  - README.md
29
28
  - Rakefile
@@ -57,7 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
57
56
  - !ruby/object:Gem::Version
58
57
  version: '0'
59
58
  requirements: []
60
- rubygems_version: 3.1.4
59
+ rubygems_version: 3.2.2
61
60
  signing_key:
62
61
  specification_version: 4
63
62
  summary: Unofficial Ruby Client for SENEC Home
@@ -1,63 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- senec (0.1.0)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- ast (2.4.1)
10
- diff-lcs (1.4.4)
11
- parallel (1.20.1)
12
- parser (2.7.2.0)
13
- ast (~> 2.4.1)
14
- rainbow (3.0.0)
15
- rake (13.0.1)
16
- regexp_parser (2.0.0)
17
- rexml (3.2.4)
18
- rspec (3.10.0)
19
- rspec-core (~> 3.10.0)
20
- rspec-expectations (~> 3.10.0)
21
- rspec-mocks (~> 3.10.0)
22
- rspec-core (3.10.0)
23
- rspec-support (~> 3.10.0)
24
- rspec-expectations (3.10.0)
25
- diff-lcs (>= 1.2.0, < 2.0)
26
- rspec-support (~> 3.10.0)
27
- rspec-mocks (3.10.0)
28
- diff-lcs (>= 1.2.0, < 2.0)
29
- rspec-support (~> 3.10.0)
30
- rspec-support (3.10.0)
31
- rubocop (1.4.2)
32
- parallel (~> 1.10)
33
- parser (>= 2.7.1.5)
34
- rainbow (>= 2.2.2, < 4.0)
35
- regexp_parser (>= 1.8)
36
- rexml
37
- rubocop-ast (>= 1.1.1)
38
- ruby-progressbar (~> 1.7)
39
- unicode-display_width (>= 1.4.0, < 2.0)
40
- rubocop-ast (1.2.0)
41
- parser (>= 2.7.1.5)
42
- rubocop-performance (1.9.1)
43
- rubocop (>= 0.90.0, < 2.0)
44
- rubocop-ast (>= 0.4.0)
45
- rubocop-rspec (2.0.0)
46
- rubocop (~> 1.0)
47
- rubocop-ast (>= 1.1.0)
48
- ruby-progressbar (1.10.1)
49
- unicode-display_width (1.7.0)
50
-
51
- PLATFORMS
52
- ruby
53
-
54
- DEPENDENCIES
55
- rake
56
- rspec
57
- rubocop
58
- rubocop-performance
59
- rubocop-rspec
60
- senec!
61
-
62
- BUNDLED WITH
63
- 2.1.4