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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f3914b7ea67325757972bb42f497370f9195ba55222d5e5fc87c03af9ff7c825
4
- data.tar.gz: dca80a11290b1ea0f2b791090b83ba4a169ade0ec528f36ec92463ccb945f5dc
3
+ metadata.gz: 3fd3ccc37bfaa1b9583583d9d845200844da9f51e4231c3c527729ac7494c790
4
+ data.tar.gz: 2cd5722e55aca66579c755d6fc9490b1f546616048f3a208b4e4fce15d68723c
5
5
  SHA512:
6
- metadata.gz: d19c80369fad7f4f066e0916e26c4280eb8d2a708e149cf9fb11071f29cee49be6fdebd7b225bb1368796771d3cc73682132e22056410db03ec98bea4dbd07e8
7
- data.tar.gz: 9ca1fa435012bbe331924b1fd2173358fd700fbe3cb5fa2cbd75a9e2a59f9017c6ff575aee089df918bdfe9318dcd34c2b543ae3bd43207617af5bc96a2d79f0
6
+ metadata.gz: e14c8db17de64087e464f587764c29ea3f3d89b92edd95b1bd1a8090d81610dac5bcd5e177620260ef29784a24dc2572fc993dfda33205b7534b7d154c863dd2
7
+ data.tar.gz: c650cbe64f69875e943330752510b525d2215399b6087fcaa46625e6aa3a07f89cf3ca6699d260ac132329b5913a267526afcbc1cbf29f12331c8490f49d8350
@@ -16,6 +16,9 @@ module Senec
16
16
  GUI_INVERTER_POWER: '', # PV production (W)
17
17
  STAT_HOURS_OF_OPERATION: '' # Appliance hours of operation
18
18
  },
19
+ PV1: {
20
+ MPP_POWER: '' # List: MPP power (W)
21
+ },
19
22
  TEMPMEASURE: {
20
23
  CASE_TEMP: ''
21
24
  },
data/lib/senec/request.rb CHANGED
@@ -1,5 +1,4 @@
1
- require 'http'
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 = HTTP.post uri, json: Senec::BASIC_REQUEST
80
- raise Senec::Error, res.status.to_s unless res.status.success?
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
- JSON.parse(res.body)
85
+ res.parsed_response
83
86
  end
84
87
  end
85
88
 
86
- def uri
87
- URI.parse("http://#{@host}/lala.cgi")
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 'http'
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 = HTTP.get uri
35
- raise Senec::Error, res.status.to_s unless res.status.success?
34
+ res = HTTParty.get url
35
+ raise Senec::Error, res.message unless res.success?
36
36
 
37
- res.body.to_s
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 uri
43
- URI.parse("http://#{host}/js/DE-de.js")
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
@@ -1,3 +1,3 @@
1
1
  module Senec
2
- VERSION = '0.7.0'.freeze
2
+ VERSION = '0.7.1'.freeze
3
3
  end
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 'http', '~> 5'
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.0
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-04 00:00:00.000000000 Z
11
+ date: 2023-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: http
14
+ name: httparty
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '5'
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: '5'
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.6
76
+ rubygems_version: 3.4.7
77
77
  signing_key:
78
78
  specification_version: 4
79
79
  summary: Unofficial Ruby Client for SENEC Home