senec 0.15.0 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1b624e179ea03733c86e4cbe7c93221809921317a274f33fd291ae007dafec2e
4
- data.tar.gz: 4c96d04accfa2f6a091ffa0051a939c9d2e5f69196a0f45b6a33a24c50b80de7
3
+ metadata.gz: c346c95eeb0e8ad33546fed3c8bbf66ea31910f9fcc1f20a16678b901b720c7f
4
+ data.tar.gz: 948a6b2aa16c66366a46727f57e1b172e78b4976f2009ebb7ab50c569f81fe32
5
5
  SHA512:
6
- metadata.gz: 9f3e1c33b8240d88495faef212b811b4301718a84ddc1b1b994ed07a7c08653db49046b185ff42490308e29afca2a59b9a0cec0a0eeed390fbe785c6d78bd864
7
- data.tar.gz: 111937617cf40d17e6b850b158918c93a0cd661f7d8231483685b2048f5df8a91fa4780aa228fb136e2945c6ef6eb33bbfc1dbb9987b9fd9e033e984f443912b
6
+ metadata.gz: 21e66df0b03e26ed5f709ef170020876461b0164bd970202ed2b4a9d48eb1181609705764e20c48744f69a6c86aa1265e3140f86fe616c1b757b2fc5b08caf58
7
+ data.tar.gz: 5337388e3ad9a93e1bbf8737c302ff85c1eb050530ef441b3730f7efc67db7affb05de5af4fbfbb8976a1723335b081f69c19ce969979ec4a48e77789a900381
@@ -31,7 +31,7 @@ jobs:
31
31
  run: bundle exec dotenv -f ".env.test" rspec
32
32
 
33
33
  - name: Send test coverage to CodeClimate
34
- uses: paambaati/codeclimate-action@v5.0.0
34
+ uses: paambaati/codeclimate-action@v8
35
35
  if: ${{ env.CC_TEST_REPORTER_ID }}
36
36
  with:
37
37
  coverageCommand: true
@@ -1,16 +1,9 @@
1
1
  {
2
- "editor.defaultFormatter": "esbenp.prettier-vscode",
3
2
  "editor.formatOnSave": true,
4
3
  "editor.tabSize": 2,
5
4
 
6
5
  "files.trimTrailingWhitespace": true,
7
6
 
8
- "ruby.lint": {
9
- "rubocop": {
10
- "forceExclusion": true
11
- }
12
- },
13
-
14
7
  "[ruby]": {
15
8
  "editor.defaultFormatter": "Shopify.ruby-lsp",
16
9
  "editor.formatOnSave": true
data/CODE_OF_CONDUCT.md CHANGED
@@ -2,73 +2,131 @@
2
2
 
3
3
  ## Our Pledge
4
4
 
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, caste, color, religion, or sexual
10
+ identity and orientation.
11
11
 
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
22
14
 
23
- Examples of unacceptable behavior by participants include:
15
+ ## Our Standards
24
16
 
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ - Demonstrating empathy and kindness toward other people
21
+ - Being respectful of differing opinions, viewpoints, and experiences
22
+ - Giving and gracefully accepting constructive feedback
23
+ - Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ - Focusing on what is best not just for us as individuals, but for the overall
26
+ community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ - The use of sexualized language or imagery, and sexual attention or advances of
31
+ any kind
32
+ - Trolling, insulting or derogatory comments, and personal or political attacks
33
+ - Public or private harassment
34
+ - Publishing others' private information, such as a physical or email address,
35
+ without their explicit permission
36
+ - Other conduct which could reasonably be considered inappropriate in a
32
37
  professional setting
33
38
 
34
- ## Our Responsibilities
39
+ ## Enforcement Responsibilities
35
40
 
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
39
45
 
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
45
50
 
46
51
  ## Scope
47
52
 
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official email address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
54
58
 
55
59
  ## Enforcement
56
60
 
57
61
  Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at georg@ledermann.dev. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
62
+ reported to the community leaders responsible for enforcement at
63
+ [INSERT CONTACT METHOD].
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
63
82
 
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series of
86
+ actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or permanent
93
+ ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within the
113
+ community.
67
114
 
68
115
  ## Attribution
69
116
 
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [https://contributor-covenant.org/version/1/4][version]
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.1, available at
119
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
120
+
121
+ Community Impact Guidelines were inspired by
122
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123
+
124
+ For answers to common questions about this code of conduct, see the FAQ at
125
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
126
+ [https://www.contributor-covenant.org/translations][translations].
72
127
 
73
- [homepage]: https://contributor-covenant.org
74
- [version]: https://contributor-covenant.org/version/1/4/
128
+ [homepage]: https://www.contributor-covenant.org
129
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130
+ [Mozilla CoC]: https://github.com/mozilla/diversity
131
+ [FAQ]: https://www.contributor-covenant.org/faq
132
+ [translations]: https://www.contributor-covenant.org/translations
data/Gemfile CHANGED
@@ -12,20 +12,20 @@ gem 'bigdecimal'
12
12
  # Rake is a Make-like program implemented in Ruby (https://github.com/ruby/rake)
13
13
  gem 'rake'
14
14
 
15
- # rspec-3.12.0 (http://github.com/rspec)
15
+ # rspec-3.13.0 (http://github.com/rspec)
16
16
  gem 'rspec'
17
17
 
18
18
  # Automatic Ruby code style checking tool. (https://github.com/rubocop/rubocop)
19
- gem 'rubocop'
19
+ gem 'rubocop', require: false
20
20
 
21
21
  # Automatic performance checking tool for Ruby code. (https://github.com/rubocop/rubocop-performance)
22
- gem 'rubocop-performance'
22
+ gem 'rubocop-performance', require: false
23
23
 
24
24
  # Code style checking for RSpec files (https://github.com/rubocop/rubocop-rspec)
25
- gem 'rubocop-rspec'
25
+ gem 'rubocop-rspec', require: false
26
26
 
27
27
  # A RuboCop plugin for Rake (https://github.com/rubocop/rubocop-rake)
28
- gem 'rubocop-rake'
28
+ gem 'rubocop-rake', require: false
29
29
 
30
30
  # Thread-safety checks via static analysis (https://github.com/rubocop/rubocop-thread_safety)
31
31
  gem 'rubocop-thread_safety', require: false
@@ -1,6 +1,6 @@
1
- The MIT License (MIT)
1
+ MIT License
2
2
 
3
- Copyright (c) 2020-2024 Georg Ledermann
3
+ Copyright (c) 2020-2024 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
@@ -9,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
9
  copies of the Software, and to permit persons to whom the Software is
10
10
  furnished to do so, subject to the following conditions:
11
11
 
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
14
 
15
15
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
16
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
17
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -29,7 +29,8 @@ module Senec
29
29
  CASE_TEMP: ''
30
30
  },
31
31
  WALLBOX: {
32
- APPARENT_CHARGING_POWER: ''
32
+ APPARENT_CHARGING_POWER: '',
33
+ EV_CONNECTED: ''
33
34
  }
34
35
  }.freeze
35
36
 
@@ -15,18 +15,30 @@ module Senec
15
15
  # ...
16
16
  # };
17
17
  def names(language: :de)
18
- response(language:).match(FILE_REGEX)[0].split("\n").each_with_object({}) do |line, hash|
19
- key, value = line.match(LINE_REGEX)&.captures
20
- next unless key && value
18
+ js_content = response(language:)
21
19
 
22
- hash[key.to_i] = value
23
- end
20
+ # Extract the matched content
21
+ match = js_content.match(FILE_REGEX)
22
+ return unless match
23
+
24
+ # Extract the JSON-like part
25
+ json_like = "{#{match[1]}}"
26
+
27
+ # The keys are numbers, which is not valid JSON, so we need to convert them to strings
28
+ json = json_like.gsub(/(\d+)\s*:/, '"\1":')
29
+
30
+ # Convert the JSON string to a Ruby hash
31
+ hash = JSON.parse(json)
32
+
33
+ # Convert keys from strings to integers
34
+ hash.transform_keys(&:to_i)
24
35
  end
25
36
 
26
37
  private
27
38
 
28
- FILE_REGEX = /var system_state_name = \{(.*?)\};/m
29
- LINE_REGEX = /(\d+)\s*:\s*"(.*)"/
39
+ # Regex pattern to match the system_state_name definition in the JavaScript file
40
+ # The file may be minimized, so we need to be flexible with whitespace and line breaks
41
+ FILE_REGEX = /system_state_name\s*=\s*{\s*([^}]*)\s*}/m
30
42
 
31
43
  def response(language:)
32
44
  res = connection.get url(language:)
data/lib/senec/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Senec
2
- VERSION = '0.15.0'.freeze
2
+ VERSION = '0.17.0'.freeze
3
3
  end
data/senec.gemspec CHANGED
@@ -11,9 +11,9 @@ Gem::Specification.new do |spec|
11
11
  spec.homepage = 'https://github.com/solectrus/senec'
12
12
  spec.license = 'MIT'
13
13
  spec.required_ruby_version = Gem::Requirement.new('>= 3.2.0')
14
- spec.add_runtime_dependency 'faraday'
15
- spec.add_runtime_dependency 'faraday-net_http_persistent'
16
- spec.add_runtime_dependency 'faraday-request-timer'
14
+ spec.add_dependency 'faraday'
15
+ spec.add_dependency 'faraday-net_http_persistent'
16
+ spec.add_dependency 'faraday-request-timer'
17
17
 
18
18
  spec.metadata['homepage_uri'] = spec.homepage
19
19
  spec.metadata['source_code_uri'] = 'https://github.com/solectrus/senec'
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.15.0
4
+ version: 0.17.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: 2024-01-30 00:00:00.000000000 Z
11
+ date: 2024-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -67,7 +67,7 @@ files:
67
67
  - ".vscode/settings.json"
68
68
  - CODE_OF_CONDUCT.md
69
69
  - Gemfile
70
- - LICENSE.txt
70
+ - LICENSE
71
71
  - README.md
72
72
  - Rakefile
73
73
  - bin/console
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0'
110
110
  requirements: []
111
- rubygems_version: 3.5.5
111
+ rubygems_version: 3.5.17
112
112
  signing_key:
113
113
  specification_version: 4
114
114
  summary: Unofficial Ruby Client for SENEC Home