senec 0.14.0 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.env.test +3 -0
- data/.github/workflows/push.yml +1 -1
- data/Gemfile +6 -0
- data/LICENSE.txt +1 -1
- data/README.md +16 -5
- data/lib/senec/cloud/connection.rb +4 -3
- data/lib/senec/cloud/technical_data.rb +69 -0
- data/lib/senec/version.rb +1 -1
- data/lib/senec.rb +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b624e179ea03733c86e4cbe7c93221809921317a274f33fd291ae007dafec2e
|
4
|
+
data.tar.gz: 4c96d04accfa2f6a091ffa0051a939c9d2e5f69196a0f45b6a33a24c50b80de7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f3e1c33b8240d88495faef212b811b4301718a84ddc1b1b994ed07a7c08653db49046b185ff42490308e29afca2a59b9a0cec0a0eeed390fbe785c6d78bd864
|
7
|
+
data.tar.gz: 111937617cf40d17e6b850b158918c93a0cd661f7d8231483685b2048f5df8a91fa4780aa228fb136e2945c6ef6eb33bbfc1dbb9987b9fd9e033e984f443912b
|
data/.env.test
CHANGED
data/.github/workflows/push.yml
CHANGED
data/Gemfile
CHANGED
@@ -3,6 +3,12 @@ source 'https://rubygems.org'
|
|
3
3
|
# Specify your gem's dependencies in senec.gemspec
|
4
4
|
gemspec
|
5
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
|
+
|
6
12
|
# Rake is a Make-like program implemented in Ruby (https://github.com/ruby/rake)
|
7
13
|
gem 'rake'
|
8
14
|
|
data/LICENSE.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2020
|
3
|
+
Copyright (c) 2020-2024 Georg Ledermann
|
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
@@ -36,7 +36,7 @@ puts connection.systems
|
|
36
36
|
|
37
37
|
# => [{"id"=>"123456", "steuereinheitnummer"=>"S123XXX", "gehaeusenummer"=>"DE-V3-XXXX", "strasse"=>"Musterstraße", "hausnummer"=>"27a", "postleitzahl"=>"99999", "ort"=>"Musterort", "laendercode"=>"DE", "zeitzone"=>"Europe/Berlin", "wallboxIds"=>["1"], "systemType"=>"V3"}]
|
38
38
|
|
39
|
-
# Get the data of first systems (without knowing the ID):
|
39
|
+
# Get the Dashboard data of first systems (without knowing the ID):
|
40
40
|
puts Senec::Cloud::Dashboard[connection].first.data
|
41
41
|
|
42
42
|
# => {"aktuell"=>
|
@@ -62,13 +62,24 @@ puts Senec::Cloud::Dashboard[connection].first.data
|
|
62
62
|
# "zeitstempel"=>"2023-11-26T18:45:23Z",
|
63
63
|
# "electricVehicleConnected"=>false}
|
64
64
|
|
65
|
-
|
66
|
-
|
67
|
-
puts Senc::Cloud::Dashboard[connection].find("123456").data
|
65
|
+
# Get the Dashboard data of a specific system (by ID):
|
66
|
+
puts Senec::Cloud::Dashboard[connection].find("123456").data
|
68
67
|
|
69
68
|
# => {"aktuell"=>
|
70
69
|
# {"stromerzeugung"=>{"wert"=>0.01, "einheit"=>"W"},
|
71
70
|
# ....
|
71
|
+
|
72
|
+
# Get the Technical Data of a specific system (by ID):
|
73
|
+
|
74
|
+
puts Senec::Cloud::TechnicalData[connection].find("123456").data
|
75
|
+
|
76
|
+
# => {"systemOverview"=>{"systemId"=>123456, "productName"=>"SENEC.Home V3 hybrid duo", ...
|
77
|
+
|
78
|
+
# Get the Technical Data of first systems (without knowing the ID):
|
79
|
+
|
80
|
+
puts Senec::Cloud::TechnicalData[connection].first.data
|
81
|
+
|
82
|
+
# => {"systemOverview"=>{"systemId"=>123456, "productName"=>"SENEC.Home V3 hybrid duo", ...
|
72
83
|
```
|
73
84
|
|
74
85
|
### Local access (V2.1 and V3 only)
|
@@ -142,7 +153,7 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/solect
|
|
142
153
|
|
143
154
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
144
155
|
|
145
|
-
Copyright (c) 2020
|
156
|
+
Copyright (c) 2020-2024 Georg Ledermann
|
146
157
|
|
147
158
|
## Code of Conduct
|
148
159
|
|
@@ -1,9 +1,10 @@
|
|
1
1
|
module Senec
|
2
2
|
module Cloud
|
3
3
|
class Connection
|
4
|
-
def initialize(username:, password:)
|
4
|
+
def initialize(username:, password:, token: nil)
|
5
5
|
@username = username
|
6
6
|
@password = password
|
7
|
+
@token = token
|
7
8
|
end
|
8
9
|
|
9
10
|
attr_reader :username, :password
|
@@ -34,12 +35,12 @@ module Senec
|
|
34
35
|
end
|
35
36
|
end
|
36
37
|
|
37
|
-
private
|
38
|
-
|
39
38
|
def token
|
40
39
|
@token ||= login['token']
|
41
40
|
end
|
42
41
|
|
42
|
+
private
|
43
|
+
|
43
44
|
def login
|
44
45
|
post('/v1/senec/login', { username:, password: })
|
45
46
|
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require_relative 'connection'
|
2
|
+
|
3
|
+
# Model for the Senec technical data.
|
4
|
+
#
|
5
|
+
# Example use:
|
6
|
+
#
|
7
|
+
# connection = Senec::Cloud::Connection.new(username: '...', password: '...')
|
8
|
+
#
|
9
|
+
# # Get the data of a specific system:
|
10
|
+
# TechnicalData[connection].find('123456')
|
11
|
+
#
|
12
|
+
# # Get the data of the default system:
|
13
|
+
# TechnicalData[connection].first
|
14
|
+
#
|
15
|
+
module Senec
|
16
|
+
module Cloud
|
17
|
+
class TechnicalData
|
18
|
+
class Finder
|
19
|
+
def initialize(connection)
|
20
|
+
@connection = connection
|
21
|
+
end
|
22
|
+
attr_reader :connection
|
23
|
+
|
24
|
+
def find(system_id)
|
25
|
+
TechnicalData.new(connection:, system_id:).tap(&:load_data)
|
26
|
+
end
|
27
|
+
|
28
|
+
def first
|
29
|
+
find(connection.default_system_id)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.[](connection)
|
34
|
+
Finder.new(connection)
|
35
|
+
end
|
36
|
+
|
37
|
+
def initialize(connection: nil, system_id: nil, data: nil)
|
38
|
+
raise ArgumentError unless connection.nil? ^ data.nil?
|
39
|
+
|
40
|
+
@connection = connection
|
41
|
+
@system_id = system_id
|
42
|
+
|
43
|
+
# Useful for testing only
|
44
|
+
@data = data
|
45
|
+
end
|
46
|
+
|
47
|
+
def load_data
|
48
|
+
raise 'Data already present!' if @data
|
49
|
+
|
50
|
+
@system_id ||= connection.default_system_id
|
51
|
+
@data = fetch_data
|
52
|
+
end
|
53
|
+
|
54
|
+
attr_reader :system_id, :data
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
def get(path, params: nil)
|
59
|
+
@connection.get(path, params:)
|
60
|
+
end
|
61
|
+
|
62
|
+
def fetch_data
|
63
|
+
return unless system_id
|
64
|
+
|
65
|
+
get("/v1/senec/systems/#{system_id}/technical-data")
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
data/lib/senec/version.rb
CHANGED
data/lib/senec.rb
CHANGED
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.15.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: 2024-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -76,6 +76,7 @@ files:
|
|
76
76
|
- lib/senec/cloud/connection.rb
|
77
77
|
- lib/senec/cloud/dashboard.rb
|
78
78
|
- lib/senec/cloud/error.rb
|
79
|
+
- lib/senec/cloud/technical_data.rb
|
79
80
|
- lib/senec/local/connection.rb
|
80
81
|
- lib/senec/local/constants.rb
|
81
82
|
- lib/senec/local/error.rb
|
@@ -107,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
108
|
- !ruby/object:Gem::Version
|
108
109
|
version: '0'
|
109
110
|
requirements: []
|
110
|
-
rubygems_version: 3.
|
111
|
+
rubygems_version: 3.5.5
|
111
112
|
signing_key:
|
112
113
|
specification_version: 4
|
113
114
|
summary: Unofficial Ruby Client for SENEC Home
|