balboa_worldwide_app 1.2.1 → 1.2.5
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 +12 -4
- data/lib/bwa/client.rb +3 -1
- data/lib/bwa/message.rb +14 -4
- data/lib/bwa/messages/status.rb +2 -2
- data/lib/bwa/version.rb +1 -1
- metadata +21 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c54bf4de74bdb4e53dce087127534357ec05b1b0b69921f6d7c6956a566ca844
|
4
|
+
data.tar.gz: 17a7574e1134c7976505777567fd90209ebb5dc85fd358f132cb4088329a1e07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d9feac37083c472fb2609a337cd55d7e9415230f0c3192a76b161278fadf6e51659f54559b3596957c03a486359c3b2d0e5bc78f130685dba07865eac31144a
|
7
|
+
data.tar.gz: 7e10ebe03a3ac43ecbad06ea3783bbbf517ad2cde7c78f6e0bbed333399a873b6549a0db80990e15fd2b94b74c898190b626f71c49db8c84f3cdf4e25643707a
|
data/bin/bwa_mqtt_bridge
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'mqtt'
|
4
|
+
require 'sd_notify'
|
5
|
+
require 'set'
|
4
6
|
|
5
7
|
require 'bwa/client'
|
6
8
|
require 'bwa/discovery'
|
@@ -17,6 +19,9 @@ class MQTTBridge
|
|
17
19
|
|
18
20
|
publish_basic_attributes
|
19
21
|
|
22
|
+
# Tell systemd we've started up OK. Ignored if systemd not in use.
|
23
|
+
SdNotify.ready
|
24
|
+
|
20
25
|
bwa_thread = Thread.new do
|
21
26
|
loop do
|
22
27
|
begin
|
@@ -88,6 +93,9 @@ class MQTTBridge
|
|
88
93
|
(0..1).each do |i|
|
89
94
|
publish_attribute("spa/aux#{i + 1}", message.lights[i]) if @bwa.last_control_configuration2&.aux&.[](i)
|
90
95
|
end
|
96
|
+
|
97
|
+
# Tell systemd we are still alive and kicking. Ignored if systemd not in use.
|
98
|
+
SdNotify.watchdog
|
91
99
|
end
|
92
100
|
end
|
93
101
|
end
|
@@ -126,7 +134,7 @@ class MQTTBridge
|
|
126
134
|
next @bwa.toggle_blower if value == 'toggle'
|
127
135
|
@bwa.set_blower(value.to_i)
|
128
136
|
when "spa/settemperature/set"
|
129
|
-
@bwa.set_temperature(value.
|
137
|
+
@bwa.set_temperature(value.to_f)
|
130
138
|
end
|
131
139
|
end
|
132
140
|
end
|
@@ -147,7 +155,7 @@ class MQTTBridge
|
|
147
155
|
end
|
148
156
|
|
149
157
|
def publish_basic_attributes
|
150
|
-
publish("$homie", "
|
158
|
+
publish("$homie", "4.0.0")
|
151
159
|
publish("$name", "BWA Spa")
|
152
160
|
publish("$state", "init")
|
153
161
|
publish("$nodes", "spa")
|
@@ -186,10 +194,10 @@ class MQTTBridge
|
|
186
194
|
subscribe("spa/temperaturerange/set")
|
187
195
|
|
188
196
|
publish("spa/currenttemperature/$name", "Current temperature")
|
189
|
-
publish("spa/currenttemperature/$datatype", "
|
197
|
+
publish("spa/currenttemperature/$datatype", "float")
|
190
198
|
|
191
199
|
publish("spa/settemperature/$name", "Set Temperature")
|
192
|
-
publish("spa/settemperature/$datatype", "
|
200
|
+
publish("spa/settemperature/$datatype", "float")
|
193
201
|
publish("spa/settemperature/$settable", "true")
|
194
202
|
subscribe("spa/settemperature/set")
|
195
203
|
|
data/lib/bwa/client.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'uri'
|
2
|
+
|
1
3
|
require 'bwa/message'
|
2
4
|
|
3
5
|
module BWA
|
@@ -145,7 +147,7 @@ module BWA
|
|
145
147
|
# low range is 50-80 for F, 10-26 for C (by 0.5)
|
146
148
|
def set_temperature(desired)
|
147
149
|
desired *= 2 if last_status && last_status.temperature_scale == :celsius || desired < 50
|
148
|
-
send_message("\x0a\xbf\x20#{desired.chr}")
|
150
|
+
send_message("\x0a\xbf\x20#{desired.round.chr}")
|
149
151
|
end
|
150
152
|
|
151
153
|
def set_time(hour, minute, twenty_four_hour_time = false)
|
data/lib/bwa/message.rb
CHANGED
@@ -27,18 +27,28 @@ module BWA
|
|
27
27
|
offset += 1
|
28
28
|
return nil if data.length - offset < 5
|
29
29
|
|
30
|
+
# Keep scanning until message start char
|
30
31
|
next unless data[offset] == '~'
|
32
|
+
|
33
|
+
# Read length (safe since we have at least 5 chars)
|
31
34
|
length = data[offset + 1].ord
|
32
|
-
|
33
|
-
|
35
|
+
|
36
|
+
# No message is this short or this long; keep scanning
|
37
|
+
next if length < 5 or length >= '~'.ord
|
34
38
|
|
35
39
|
# don't have enough data for what this message wants;
|
36
|
-
#
|
37
|
-
|
40
|
+
# return and hope for more (yes this might cause a
|
41
|
+
# delay, but the protocol is very chatty so it won't
|
42
|
+
# be long)
|
43
|
+
return nil if length + 2 > data.length - offset
|
38
44
|
|
45
|
+
# Not properly terminated; keep scanning
|
39
46
|
next unless data[offset + length + 1] == '~'
|
40
47
|
|
48
|
+
# Not a valid checksum; keep scanning
|
41
49
|
next unless CRC.checksum(data.slice(offset + 1, length - 1)) == data[offset + length].ord
|
50
|
+
|
51
|
+
# Got a valid message!
|
42
52
|
break
|
43
53
|
end
|
44
54
|
|
data/lib/bwa/messages/status.rb
CHANGED
@@ -81,8 +81,8 @@ module BWA
|
|
81
81
|
self.current_temperature = nil if self.current_temperature == 0xff
|
82
82
|
self.set_temperature = data[20].ord
|
83
83
|
if temperature_scale == :celsius
|
84
|
-
self.current_temperature /= 2.0
|
85
|
-
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
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
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.2.
|
4
|
+
version: 1.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cody Cutrer
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: digest-crc
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 1.0.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: sd_notify
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.1.1
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.1.1
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: byebug
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,7 +108,7 @@ dependencies:
|
|
94
108
|
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: '13.0'
|
97
|
-
description:
|
111
|
+
description:
|
98
112
|
email: cody@cutrer.com'
|
99
113
|
executables:
|
100
114
|
- bwa_mqtt_bridge
|
@@ -128,7 +142,7 @@ homepage: https://github.com/ccutrer/bwa
|
|
128
142
|
licenses:
|
129
143
|
- MIT
|
130
144
|
metadata: {}
|
131
|
-
post_install_message:
|
145
|
+
post_install_message:
|
132
146
|
rdoc_options: []
|
133
147
|
require_paths:
|
134
148
|
- lib
|
@@ -143,8 +157,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
157
|
- !ruby/object:Gem::Version
|
144
158
|
version: '0'
|
145
159
|
requirements: []
|
146
|
-
rubygems_version: 3.1.
|
147
|
-
signing_key:
|
160
|
+
rubygems_version: 3.1.2
|
161
|
+
signing_key:
|
148
162
|
specification_version: 4
|
149
163
|
summary: Library for communication with Balboa Water Group's WiFi module or RS-485
|
150
164
|
test_files: []
|