balboa_worldwide_app 1.2.3 → 1.2.4
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 +8 -1
- data/lib/bwa/message.rb +14 -4
- data/lib/bwa/version.rb +1 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c8aedb1449973af5ee03ee3927e31e6c5edaa76305ff556ab48eaccc94fc7bf
|
4
|
+
data.tar.gz: e43450ff21fe2bfabf8514642b7ce98576a32b60aa3b06a8364c5e8fd8d3ed1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af663ca63be3bd5f2a80da01d038e9853bdb7781972a2da443ad22cf89f2915f5dd3feeab030a4be8e62682aa8c472a6610537583c8d48674ff68fce5527db31
|
7
|
+
data.tar.gz: aa3fbecd9f50d93097852eaf13124c671a488afc2001ec12ec4500c46349db6be6f7b81631f44dccdc9f68e3ff0157e090018b8a615fe28662eb18bdcdb26285
|
data/bin/bwa_mqtt_bridge
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'mqtt'
|
4
|
+
require 'sd_notify'
|
4
5
|
|
5
6
|
require 'bwa/client'
|
6
7
|
require 'bwa/discovery'
|
@@ -17,6 +18,9 @@ class MQTTBridge
|
|
17
18
|
|
18
19
|
publish_basic_attributes
|
19
20
|
|
21
|
+
# Tell systemd we've started up OK. Ignored if systemd not in use.
|
22
|
+
SdNotify.ready
|
23
|
+
|
20
24
|
bwa_thread = Thread.new do
|
21
25
|
loop do
|
22
26
|
begin
|
@@ -88,6 +92,9 @@ class MQTTBridge
|
|
88
92
|
(0..1).each do |i|
|
89
93
|
publish_attribute("spa/aux#{i + 1}", message.lights[i]) if @bwa.last_control_configuration2&.aux&.[](i)
|
90
94
|
end
|
95
|
+
|
96
|
+
# Tell systemd we are still alive and kicking. Ignored if systemd not in use.
|
97
|
+
SdNotify.watchdog
|
91
98
|
end
|
92
99
|
end
|
93
100
|
end
|
@@ -147,7 +154,7 @@ class MQTTBridge
|
|
147
154
|
end
|
148
155
|
|
149
156
|
def publish_basic_attributes
|
150
|
-
publish("$homie", "
|
157
|
+
publish("$homie", "4.0.0")
|
151
158
|
publish("$name", "BWA Spa")
|
152
159
|
publish("$state", "init")
|
153
160
|
publish("$nodes", "spa")
|
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/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.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cody Cutrer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-04-21 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
|
@@ -143,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
157
|
- !ruby/object:Gem::Version
|
144
158
|
version: '0'
|
145
159
|
requirements: []
|
146
|
-
rubygems_version: 3.
|
160
|
+
rubygems_version: 3.1.2
|
147
161
|
signing_key:
|
148
162
|
specification_version: 4
|
149
163
|
summary: Library for communication with Balboa Water Group's WiFi module or RS-485
|