balboa_worldwide_app 1.1.0 → 1.2.2
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 +12 -6
- data/lib/bwa/message.rb +27 -9
- data/lib/bwa/messages/configuration.rb +1 -1
- data/lib/bwa/messages/configuration_request.rb +1 -1
- data/lib/bwa/messages/control_configuration.rb +2 -6
- data/lib/bwa/messages/control_configuration_request.rb +1 -1
- data/lib/bwa/messages/filter_cycles.rb +1 -1
- data/lib/bwa/messages/ready.rb +1 -1
- data/lib/bwa/messages/set_temperature.rb +1 -1
- data/lib/bwa/messages/set_temperature_scale.rb +1 -1
- data/lib/bwa/messages/set_time.rb +1 -1
- data/lib/bwa/messages/status.rb +5 -3
- data/lib/bwa/messages/toggle_item.rb +3 -1
- data/lib/bwa/version.rb +2 -2
- 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: 9b3690c43f61e80376391c61d447f3e8430ae844ffc5d380afa9bb90636095bd
|
4
|
+
data.tar.gz: 284a4856cac4830956a8e944572ce724f0bbeba98efa3cba0a879d932193bc23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a82e78b7f1ea26b74fe71117e9ca9c549708851f39a62c176650faf12c972f32658a541edac023ccd81def26fa6c2e8844adb3bf8b0f95bc4720ecf11d44e9c
|
7
|
+
data.tar.gz: 00ffc61f1eb37ac4025e03e3a0412835e1211f2faa82d46dc6115de3a13ede7e4526fe3527bd9d04b9dfb8873ccfe566992e7a8a6955adca55161a6be2d45dd3
|
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 = ""
|
@@ -25,10 +25,16 @@ module BWA
|
|
25
25
|
message = bytes_read = nil
|
26
26
|
loop do
|
27
27
|
message, bytes_read = Message.parse(@buffer)
|
28
|
-
|
29
|
-
|
28
|
+
# discard how much we read
|
29
|
+
@buffer = @buffer[bytes_read..-1] if bytes_read
|
30
|
+
method = @io.respond_to?(:readpartial) ? :readpartial : :read
|
30
31
|
unless message
|
31
|
-
|
32
|
+
begin
|
33
|
+
@buffer.concat(@io.__send__(method, 64 * 1024))
|
34
|
+
rescue EOFError
|
35
|
+
@io.wait_readable
|
36
|
+
retry
|
37
|
+
end
|
32
38
|
next
|
33
39
|
end
|
34
40
|
break
|
@@ -139,7 +145,7 @@ module BWA
|
|
139
145
|
# low range is 50-80 for F, 10-26 for C (by 0.5)
|
140
146
|
def set_temperature(desired)
|
141
147
|
desired *= 2 if last_status && last_status.temperature_scale == :celsius || desired < 50
|
142
|
-
send_message("\x0a\xbf\x20#{desired.chr}")
|
148
|
+
send_message("\x0a\xbf\x20#{desired.round.chr}")
|
143
149
|
end
|
144
150
|
|
145
151
|
def set_time(hour, minute, twenty_four_hour_time = false)
|
data/lib/bwa/message.rb
CHANGED
@@ -11,6 +11,9 @@ module BWA
|
|
11
11
|
end
|
12
12
|
|
13
13
|
class Message
|
14
|
+
class Unrecognized < Message
|
15
|
+
end
|
16
|
+
|
14
17
|
class << self
|
15
18
|
def inherited(klass)
|
16
19
|
@messages ||= []
|
@@ -42,21 +45,31 @@ module BWA
|
|
42
45
|
puts "discarding invalid data prior to message #{data[0...offset].unpack('H*').first}" unless offset == 0
|
43
46
|
#puts "read #{data.slice(offset, length + 2).unpack('H*').first}"
|
44
47
|
|
45
|
-
|
48
|
+
src = data[offset + 2].ord
|
49
|
+
message_type = data.slice(offset + 3, 2)
|
46
50
|
klass = @messages.find { |k| k::MESSAGE_TYPE == message_type }
|
47
51
|
|
48
52
|
|
49
53
|
return [nil, offset + length + 2] if [
|
50
|
-
"\
|
51
|
-
"\
|
52
|
-
"\
|
53
|
-
|
54
|
-
|
55
|
-
|
54
|
+
"\xbf\x00".force_encoding(Encoding::ASCII_8BIT),
|
55
|
+
"\xbf\xe1".force_encoding(Encoding::ASCII_8BIT),
|
56
|
+
"\xbf\x07".force_encoding(Encoding::ASCII_8BIT)].include?(message_type)
|
57
|
+
|
58
|
+
if klass
|
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
|
65
|
+
else
|
66
|
+
klass = Unrecognized
|
67
|
+
end
|
56
68
|
|
57
69
|
message = klass.new
|
58
70
|
message.parse(data.slice(offset + 5, length - 5))
|
59
71
|
message.instance_variable_set(:@raw_data, data.slice(offset, length + 2))
|
72
|
+
message.instance_variable_set(:@src, src)
|
60
73
|
[message, offset + length + 2]
|
61
74
|
end
|
62
75
|
|
@@ -76,14 +89,19 @@ module BWA
|
|
76
89
|
end
|
77
90
|
end
|
78
91
|
|
79
|
-
attr_reader :raw_data
|
92
|
+
attr_reader :raw_data, :src
|
93
|
+
|
94
|
+
def initialize
|
95
|
+
# most messages we're sending come from this address
|
96
|
+
@src = 0x0a
|
97
|
+
end
|
80
98
|
|
81
99
|
def parse(_data)
|
82
100
|
end
|
83
101
|
|
84
102
|
def serialize(message = "")
|
85
103
|
length = message.length + 5
|
86
|
-
full_message = "#{length.chr}#{self.class::MESSAGE_TYPE}#{message}".force_encoding(Encoding::ASCII_8BIT)
|
104
|
+
full_message = "#{length.chr}#{src.chr}#{self.class::MESSAGE_TYPE}#{message}".force_encoding(Encoding::ASCII_8BIT)
|
87
105
|
checksum = CRC.checksum(full_message)
|
88
106
|
"\x7e#{full_message}#{checksum.chr}\x7e".force_encoding(Encoding::ASCII_8BIT)
|
89
107
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module BWA
|
2
2
|
module Messages
|
3
3
|
class ControlConfiguration < Message
|
4
|
-
MESSAGE_TYPE = "\
|
4
|
+
MESSAGE_TYPE = "\xbf\x24".force_encoding(Encoding::ASCII_8BIT)
|
5
5
|
MESSAGE_LENGTH = 21
|
6
6
|
|
7
7
|
attr_accessor :model, :version
|
@@ -20,13 +20,9 @@ module BWA
|
|
20
20
|
"#<BWA::Messages::ControlConfiguration #{model} #{version}>"
|
21
21
|
end
|
22
22
|
end
|
23
|
-
end
|
24
|
-
end
|
25
23
|
|
26
|
-
module BWA
|
27
|
-
module Messages
|
28
24
|
class ControlConfiguration2 < Message
|
29
|
-
MESSAGE_TYPE = "\
|
25
|
+
MESSAGE_TYPE = "\xbf\x2e".force_encoding(Encoding::ASCII_8BIT)
|
30
26
|
MESSAGE_LENGTH = 6
|
31
27
|
|
32
28
|
attr_accessor :pumps, :lights, :circ_pump, :blower, :mister, :aux
|
@@ -5,7 +5,7 @@ module BWA
|
|
5
5
|
:filter2_enabled,
|
6
6
|
:filter2_hour, :filter2_minute, :filter2_duration_hours, :filter2_duration_minutes
|
7
7
|
|
8
|
-
MESSAGE_TYPE = "\
|
8
|
+
MESSAGE_TYPE = "\xbf\x23".force_encoding(Encoding::ASCII_8BIT)
|
9
9
|
MESSAGE_LENGTH = 8
|
10
10
|
|
11
11
|
def parse(data)
|
data/lib/bwa/messages/ready.rb
CHANGED
@@ -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
@@ -17,10 +17,12 @@ module BWA
|
|
17
17
|
:aux,
|
18
18
|
:current_temperature, :set_temperature
|
19
19
|
|
20
|
-
MESSAGE_TYPE = "\
|
21
|
-
|
20
|
+
MESSAGE_TYPE = "\xaf\x13".force_encoding(Encoding::ASCII_8BIT)
|
21
|
+
# additional features have been added in later versions
|
22
|
+
MESSAGE_LENGTH = 24..32
|
22
23
|
|
23
24
|
def initialize
|
25
|
+
@src = 0xff
|
24
26
|
self.priming = false
|
25
27
|
self.heating_mode = :ready
|
26
28
|
@temperature_scale = :fahrenheit
|
@@ -170,4 +172,4 @@ module BWA
|
|
170
172
|
end
|
171
173
|
end
|
172
174
|
end
|
173
|
-
end
|
175
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module BWA
|
2
2
|
module Messages
|
3
3
|
class ToggleItem < Message
|
4
|
-
MESSAGE_TYPE = "\
|
4
|
+
MESSAGE_TYPE = "\xbf\x11".force_encoding(Encoding::ASCII_8BIT)
|
5
5
|
MESSAGE_LENGTH = 2
|
6
6
|
|
7
7
|
attr_accessor :item
|
@@ -15,8 +15,10 @@ module BWA
|
|
15
15
|
when 0x04; :pump1
|
16
16
|
when 0x05; :pump2
|
17
17
|
when 0x11; :light1
|
18
|
+
when 0x3c; :hold
|
18
19
|
when 0x50; :temperature_range
|
19
20
|
when 0x51; :heating_mode
|
21
|
+
else; data[0].ord
|
20
22
|
end
|
21
23
|
end
|
22
24
|
|
data/lib/bwa/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module BWA
|
2
|
-
VERSION = '1.
|
3
|
-
end
|
2
|
+
VERSION = '1.2.2'
|
3
|
+
end
|
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.2
|
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
|