balboa_worldwide_app 1.1.1 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/bwa_mqtt_bridge +3 -3
- data/lib/bwa/client.rb +5 -4
- data/lib/bwa/message.rb +6 -1
- data/lib/bwa/messages/set_temperature.rb +1 -1
- data/lib/bwa/messages/set_time.rb +1 -1
- data/lib/bwa/messages/status.rb +5 -4
- data/lib/bwa/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b84555384635c30873c0b10743bd87990e7fc3b6a85fc05f21ce3759d59ddbe
|
4
|
+
data.tar.gz: ef7e20ab1436da76d5024a9a5641e8301795246ee8afcfbfa3a6535f787f2ddb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5cfe6592a743e415736015aadac86d71c6ba30d0fb1c562d4797103677daf725a2cfce22fd52c955d73c942bec9ea990f67a452a11244f1754a667ab9eed7c55
|
7
|
+
data.tar.gz: 00117540563ef4eebb1b577ab4f24a6414d7595b2312f220e84ae391715d472a333f5e92da150e0dce18bf9ae265c06d153f59da6dfe5abe834c3ee5648cebee
|
data/bin/bwa_mqtt_bridge
CHANGED
@@ -126,7 +126,7 @@ class MQTTBridge
|
|
126
126
|
next @bwa.toggle_blower if value == 'toggle'
|
127
127
|
@bwa.set_blower(value.to_i)
|
128
128
|
when "spa/settemperature/set"
|
129
|
-
@bwa.set_temperature(value.
|
129
|
+
@bwa.set_temperature(value.to_f)
|
130
130
|
end
|
131
131
|
end
|
132
132
|
end
|
@@ -186,10 +186,10 @@ class MQTTBridge
|
|
186
186
|
subscribe("spa/temperaturerange/set")
|
187
187
|
|
188
188
|
publish("spa/currenttemperature/$name", "Current temperature")
|
189
|
-
publish("spa/currenttemperature/$datatype", "
|
189
|
+
publish("spa/currenttemperature/$datatype", "float")
|
190
190
|
|
191
191
|
publish("spa/settemperature/$name", "Set Temperature")
|
192
|
-
publish("spa/settemperature/$datatype", "
|
192
|
+
publish("spa/settemperature/$datatype", "float")
|
193
193
|
publish("spa/settemperature/$settable", "true")
|
194
194
|
subscribe("spa/settemperature/set")
|
195
195
|
|
data/lib/bwa/client.rb
CHANGED
@@ -14,8 +14,8 @@ module BWA
|
|
14
14
|
@io = Net::Telnet::RFC2217.new("Host" => uri.host, "Port" => uri.port || 23, "baud" => 115200)
|
15
15
|
@queue = []
|
16
16
|
else
|
17
|
-
require 'serialport'
|
18
|
-
@io = SerialPort.
|
17
|
+
require 'ccutrer-serialport'
|
18
|
+
@io = CCutrer::SerialPort.new(uri.path, baud: 115200)
|
19
19
|
@queue = []
|
20
20
|
end
|
21
21
|
@buffer = ""
|
@@ -27,9 +27,10 @@ module BWA
|
|
27
27
|
message, bytes_read = Message.parse(@buffer)
|
28
28
|
# discard how much we read
|
29
29
|
@buffer = @buffer[bytes_read..-1] if bytes_read
|
30
|
+
method = @io.respond_to?(:readpartial) ? :readpartial : :read
|
30
31
|
unless message
|
31
32
|
begin
|
32
|
-
@buffer.concat(@io.
|
33
|
+
@buffer.concat(@io.__send__(method, 64 * 1024))
|
33
34
|
rescue EOFError
|
34
35
|
@io.wait_readable
|
35
36
|
retry
|
@@ -144,7 +145,7 @@ module BWA
|
|
144
145
|
# low range is 50-80 for F, 10-26 for C (by 0.5)
|
145
146
|
def set_temperature(desired)
|
146
147
|
desired *= 2 if last_status && last_status.temperature_scale == :celsius || desired < 50
|
147
|
-
send_message("\x0a\xbf\x20#{desired.chr}")
|
148
|
+
send_message("\x0a\xbf\x20#{desired.round.chr}")
|
148
149
|
end
|
149
150
|
|
150
151
|
def set_time(hour, minute, twenty_four_hour_time = false)
|
data/lib/bwa/message.rb
CHANGED
@@ -56,7 +56,12 @@ module BWA
|
|
56
56
|
"\xbf\x07".force_encoding(Encoding::ASCII_8BIT)].include?(message_type)
|
57
57
|
|
58
58
|
if klass
|
59
|
-
|
59
|
+
valid_length = if klass::MESSAGE_LENGTH.respond_to?(:include?)
|
60
|
+
klass::MESSAGE_LENGTH.include?(length - 5)
|
61
|
+
else
|
62
|
+
length - 5 == klass::MESSAGE_LENGTH
|
63
|
+
end
|
64
|
+
raise InvalidMessage.new("Unrecognized data length (#{length}) for message #{klass}", data) unless valid_length
|
60
65
|
else
|
61
66
|
klass = Unrecognized
|
62
67
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module BWA
|
2
2
|
module Messages
|
3
3
|
class SetTime < Message
|
4
|
-
MESSAGE_TYPE = "\
|
4
|
+
MESSAGE_TYPE = "\xbf\x21".force_encoding(Encoding::ASCII_8BIT)
|
5
5
|
MESSAGE_LENGTH = 2
|
6
6
|
|
7
7
|
attr_accessor :hour, :minute, :twenty_four_hour_time
|
data/lib/bwa/messages/status.rb
CHANGED
@@ -18,7 +18,8 @@ module BWA
|
|
18
18
|
:current_temperature, :set_temperature
|
19
19
|
|
20
20
|
MESSAGE_TYPE = "\xaf\x13".force_encoding(Encoding::ASCII_8BIT)
|
21
|
-
|
21
|
+
# additional features have been added in later versions
|
22
|
+
MESSAGE_LENGTH = 24..32
|
22
23
|
|
23
24
|
def initialize
|
24
25
|
@src = 0xff
|
@@ -80,8 +81,8 @@ module BWA
|
|
80
81
|
self.current_temperature = nil if self.current_temperature == 0xff
|
81
82
|
self.set_temperature = data[20].ord
|
82
83
|
if temperature_scale == :celsius
|
83
|
-
self.current_temperature /= 2.0
|
84
|
-
self.set_temperature /= 2.0
|
84
|
+
self.current_temperature /= 2.0 if self.current_temperature
|
85
|
+
self.set_temperature /= 2.0 if self.set_temperature
|
85
86
|
end
|
86
87
|
end
|
87
88
|
|
@@ -171,4 +172,4 @@ module BWA
|
|
171
172
|
end
|
172
173
|
end
|
173
174
|
end
|
174
|
-
end
|
175
|
+
end
|
data/lib/bwa/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: balboa_worldwide_app
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cody Cutrer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: digest-crc
|
@@ -53,19 +53,19 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 0.0.3
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name: serialport
|
56
|
+
name: ccutrer-serialport
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.
|
61
|
+
version: 1.0.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 1.
|
68
|
+
version: 1.0.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: byebug
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|