pzem016 0.1.1 → 0.1.3

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: c8870c9a02b2b9d7b647c413c7f3150e61854864e499a9d8c2327288309e510c
4
- data.tar.gz: 3e8b962f8fc84b3ef8db966fd8626087505889e72d7b49cec56cd20c1c7e3b17
3
+ metadata.gz: 893bb8b964fcd2cc4c17f7c82bd4f838114d9d832448e40b8e3281f3b322cd43
4
+ data.tar.gz: f78d11aac4f41c84f6b2e251fbcd12e52c764bed8bd6c4c83edab3c48541a255
5
5
  SHA512:
6
- metadata.gz: bedbdb327e5acc293177ceded7757594b0b640ad9617305013742c446ffbc8d06e0b4a883f62d598310c4e869b941a8cf61328e01a227d722adad32506241dbc
7
- data.tar.gz: 06f43088e9b695c622a0671fcdd79103d10bc3185b60ff684fd1945f23fd698d2427affaeb9dd491faeaf728877fc8eaf8a327edcff636c59382fa97696dce3f
6
+ metadata.gz: 8ad416faf49bbabc006a33489702d53810407846ac43f81bd1c03731006f5ac7f9d6cbdac72125e008363e94f5ccb14f78865cbdd064180071ef04feb1f288fb
7
+ data.tar.gz: 32188e79a095f20a3c75349c534850ee1b962a4f85d173c06e84191b0c538a9962d79e1013df09e8df1bd6bd41069fe1677784411be9bc06b56749b9c5c7dd3f
data/CHANGELOG CHANGED
@@ -1,2 +1,4 @@
1
+ 0.1.3 - add slave address to report hash
2
+ 0.1.2 - add progress bar, add LICENSE, more doc fixes
1
3
  0.1.1 - doc fixes
2
4
  0.1.0 - initial release
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 svdasein
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
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 THE
21
+ SOFTWARE.
data/exe/pzem016.rb CHANGED
@@ -108,9 +108,11 @@ begin
108
108
  puts "Slave at addr #{cmd_opts[:sladdr]} energy counter reset: #{Pzem016::HoldingRegisters.new(global_opts[:name],
109
109
  bus.with_slave(cmd_opts[:sladdr])).reset_energy}"
110
110
  when :scanbus
111
+ progress = ProgressBar.create(title: "sladdr", total: 247,length: 80,format: '%t %c/%C (%j%): |%B|' )
111
112
  begin
112
113
  (1..247).each do |address|
113
114
  bus.with_slave(address) do |slave|
115
+ progress.increment
114
116
  slave.read_retry_timeout = global_opts[:timeout]
115
117
  slave.read_retries = global_opts[:retries]
116
118
  begin
@@ -123,7 +125,7 @@ begin
123
125
  puts
124
126
  end
125
127
  rescue StandardError
126
- print '.'
128
+ # don't care
127
129
  end
128
130
  end
129
131
  end
@@ -94,6 +94,7 @@ module Pzem016
94
94
  #
95
95
  def to_hash
96
96
  {
97
+ "SlaveAddr": @slave.uid,
97
98
  "DeviceName": @name,
98
99
  "Address": @raw[2],
99
100
  "AlarmWatts": @raw[1]
@@ -168,6 +169,7 @@ module Pzem016
168
169
  #
169
170
  def to_hash
170
171
  {
172
+ "SlaveAddr": @slave.uid,
171
173
  "DeviceName": @name,
172
174
  "Volts": volts,
173
175
  "Amps": amps,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Pzem016
4
- VERSION = '0.1.1'
4
+ VERSION = '0.1.3'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pzem016
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Parker
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-03-23 00:00:00.000000000 Z
11
+ date: 2024-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_print
@@ -77,6 +77,7 @@ extensions: []
77
77
  extra_rdoc_files: []
78
78
  files:
79
79
  - CHANGELOG
80
+ - LICENSE
80
81
  - PZEM016-bench.jpg
81
82
  - README.md
82
83
  - Rakefile