senec 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/senec/constants.rb +3 -0
- data/lib/senec/request.rb +10 -7
- data/lib/senec/state.rb +6 -6
- data/lib/senec/version.rb +1 -1
- data/senec.gemspec +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fd3ccc37bfaa1b9583583d9d845200844da9f51e4231c3c527729ac7494c790
|
4
|
+
data.tar.gz: 2cd5722e55aca66579c755d6fc9490b1f546616048f3a208b4e4fce15d68723c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e14c8db17de64087e464f587764c29ea3f3d89b92edd95b1bd1a8090d81610dac5bcd5e177620260ef29784a24dc2572fc993dfda33205b7534b7d154c863dd2
|
7
|
+
data.tar.gz: c650cbe64f69875e943330752510b525d2215399b6087fcaa46625e6aa3a07f89cf3ca6699d260ac132329b5913a267526afcbc1cbf29f12331c8490f49d8350
|
data/lib/senec/constants.rb
CHANGED
data/lib/senec/request.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
require '
|
2
|
-
require 'json'
|
1
|
+
require 'httparty'
|
3
2
|
require 'senec/value'
|
4
3
|
require 'senec/constants'
|
5
4
|
|
@@ -18,6 +17,10 @@ module Senec
|
|
18
17
|
get('ENERGY', 'GUI_INVERTER_POWER')
|
19
18
|
end
|
20
19
|
|
20
|
+
def mpp_power
|
21
|
+
get('PV1', 'MPP_POWER')
|
22
|
+
end
|
23
|
+
|
21
24
|
def bat_power
|
22
25
|
get('ENERGY', 'GUI_BAT_DATA_POWER')
|
23
26
|
end
|
@@ -76,15 +79,15 @@ module Senec
|
|
76
79
|
|
77
80
|
def response
|
78
81
|
@response ||= begin
|
79
|
-
res =
|
80
|
-
raise Senec::Error, res.
|
82
|
+
res = HTTParty.post(url, body: JSON.generate(Senec::BASIC_REQUEST))
|
83
|
+
raise Senec::Error, res.message.to_s unless res.success?
|
81
84
|
|
82
|
-
|
85
|
+
res.parsed_response
|
83
86
|
end
|
84
87
|
end
|
85
88
|
|
86
|
-
def
|
87
|
-
|
89
|
+
def url
|
90
|
+
"http://#{@host}/lala.cgi"
|
88
91
|
end
|
89
92
|
end
|
90
93
|
end
|
data/lib/senec/state.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'httparty'
|
2
2
|
|
3
3
|
module Senec
|
4
4
|
class State
|
@@ -31,16 +31,16 @@ module Senec
|
|
31
31
|
|
32
32
|
def response
|
33
33
|
@response ||= begin
|
34
|
-
res =
|
35
|
-
raise Senec::Error, res.
|
34
|
+
res = HTTParty.get url
|
35
|
+
raise Senec::Error, res.message unless res.success?
|
36
36
|
|
37
|
-
res.body
|
37
|
+
res.body
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
41
|
# Use the JavaScript file with German names from the SENEC web interface
|
42
|
-
def
|
43
|
-
|
42
|
+
def url
|
43
|
+
"http://#{host}/js/DE-de.js"
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
data/lib/senec/version.rb
CHANGED
data/senec.gemspec
CHANGED
@@ -11,7 +11,7 @@ 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.0.0')
|
14
|
-
spec.add_runtime_dependency '
|
14
|
+
spec.add_runtime_dependency 'httparty'
|
15
15
|
|
16
16
|
spec.metadata['homepage_uri'] = spec.homepage
|
17
17
|
spec.metadata['source_code_uri'] = 'https://github.com/solectrus/senec'
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: senec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Georg Ledermann
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-02-
|
11
|
+
date: 2023-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: httparty
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0'
|
27
27
|
description: Access your local SENEC Solar Battery Storage System
|
28
28
|
email:
|
29
29
|
- georg@ledermann.dev
|
@@ -73,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '0'
|
75
75
|
requirements: []
|
76
|
-
rubygems_version: 3.4.
|
76
|
+
rubygems_version: 3.4.7
|
77
77
|
signing_key:
|
78
78
|
specification_version: 4
|
79
79
|
summary: Unofficial Ruby Client for SENEC Home
|