Skip to content

Commit

Permalink
Fix string length typo
Browse files Browse the repository at this point in the history
  • Loading branch information
bmhughes committed Jun 7, 2019
1 parent d73188f commit 9b8de4e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# tp_link_smartplug

## v0.0.3

- Fix string length typo

## v0.0.2

- Add required ruby version to gemspec
Expand Down
4 changes: 2 additions & 2 deletions lib/tp_link_smartplug/message.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module Message

def poll(address:, port:, command:, timeout: 3, debug: false)
socket = connect(address: address, port: port, timeout: timeout, debug: debug)
STDOUT.puts(debug_message("Sending: #{decrypt(encrypt(command)[4..str.length])}")) if debug
STDOUT.puts(debug_message("Sending: #{decrypt(encrypt(command)[4..command.length])}")) if debug

begin
socket.write_nonblock(encrypt(command))
Expand All @@ -28,7 +28,7 @@ def poll(address:, port:, command:, timeout: 3, debug: false)
raise 'No data received' if data.nil? || data.empty?

STDOUT.puts(debug_message("Received Raw: #{data}")) if debug
data = decrypt(data[4..str.length])
data = decrypt(data[4..data.length])
STDOUT.puts(debug_message("Received: #{data}")) if debug

data
Expand Down
2 changes: 1 addition & 1 deletion tp_link_smartplug.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Gem::Specification.new do |spec|
spec.name = 'tp_link_smartplug'
spec.version = '0.0.2'
spec.version = '0.0.3'
spec.summary = 'TP-Link HS100/110 Smart Plug interaction library'
spec.description = 'Control and retrieve data from a TP-Link HS100/110 (Metered) Smartplug'
spec.authors = ['Ben Hughes']
Expand Down

0 comments on commit 9b8de4e

Please sign in to comment.