meshtastic 0.0.95 → 0.0.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/meshtastic/mqtt.rb +5 -4
- data/lib/meshtastic/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 380975d39b9d6eaf059284f0ecf7fa4cc8a9364c52484fd1953a0549d8cd0753
|
4
|
+
data.tar.gz: 6df8e45efd4bff03d8f5ff95c5fe09f3d20d1c21b0c636633ff19d05e720a1c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04b5b6da18e7289b2233b7513a85b6db2f5c173dd9e700b0ce416bd172547780f4ac200d98dce321a34078c18f0b10254f8107134543f170736e069263fd299b
|
7
|
+
data.tar.gz: b851700c5301a58b61530632a0f9b2bd7ace232f2155bfd7be40e64641fd420da6fc01352f01f73f794980952601c08632adadfee8808fa2ae10f1ef728f47f5
|
data/README.md
CHANGED
@@ -44,7 +44,7 @@ mqtt_obj = Meshastic::MQTT.connect
|
|
44
44
|
Meshtastic::MQTT.subscribe(
|
45
45
|
mqtt_obj: mqtt_obj,
|
46
46
|
region: 'US',
|
47
|
-
|
47
|
+
channel_topic: '2/e/LongFast/#',
|
48
48
|
psks: { LongFast: 'AQ==' }
|
49
49
|
) do |message|
|
50
50
|
puts message.inspect
|
@@ -76,7 +76,7 @@ mqtt_obj = Meshastic::MQTT.connect
|
|
76
76
|
Meshtastic::MQTT.subscribe(
|
77
77
|
mqtt_obj: mqtt_obj,
|
78
78
|
region: 'US',
|
79
|
-
|
79
|
+
channel_topic: '2/e/LongFast/#',
|
80
80
|
psks: { LongFast: 'AQ==' },
|
81
81
|
filter: '!YOUR_CLIENT_ID'
|
82
82
|
) do |message|
|
data/lib/meshtastic/mqtt.rb
CHANGED
@@ -30,6 +30,7 @@ module Meshtastic
|
|
30
30
|
username = opts[:username] ||= 'meshdev'
|
31
31
|
password = opts[:password] ||= 'large4cats'
|
32
32
|
client_id = opts[:client_id] ||= SecureRandom.random_bytes(4).unpack1('H*').to_s
|
33
|
+
client_id = format("0.8x", client_id) if client_id.is_a?(Integer)
|
33
34
|
client_id = client_id.delete('!') if client_id.include?('!')
|
34
35
|
|
35
36
|
MQTTClient.connect(
|
@@ -48,7 +49,7 @@ module Meshtastic
|
|
48
49
|
# mqtt_obj: 'required - mqtt_obj returned from #connect method'
|
49
50
|
# root_topic: 'optional - root topic (default: msh)',
|
50
51
|
# region: 'optional - region e.g. 'US/VA', etc (default: US)',
|
51
|
-
#
|
52
|
+
# channel_topic: 'optional - channel ID path e.g. "2/stat/#" (default: "2/e/LongFast/#")',
|
52
53
|
# psks: 'optional - hash of :channel_id => psk key value pairs (default: { LongFast: "AQ==" })',
|
53
54
|
# qos: 'optional - quality of service (default: 0)',
|
54
55
|
# filter: 'optional - comma-delimited string(s) to filter on in message (default: nil)',
|
@@ -60,7 +61,7 @@ module Meshtastic
|
|
60
61
|
mqtt_obj = opts[:mqtt_obj]
|
61
62
|
root_topic = opts[:root_topic] ||= 'msh'
|
62
63
|
region = opts[:region] ||= 'US'
|
63
|
-
|
64
|
+
channel_topic = opts[:channel_topic] ||= '2/e/LongFast/#'
|
64
65
|
# TODO: Support Array of PSKs and attempt each until decrypted
|
65
66
|
|
66
67
|
public_psk = '1PG7OiApB1nwvP+rz05pAQ=='
|
@@ -77,7 +78,7 @@ module Meshtastic
|
|
77
78
|
include_raw = opts[:include_raw] ||= false
|
78
79
|
|
79
80
|
# NOTE: Use MQTT Explorer for topic discovery
|
80
|
-
full_topic = "#{root_topic}/#{region}/#{
|
81
|
+
full_topic = "#{root_topic}/#{region}/#{channel_topic}"
|
81
82
|
full_topic = "#{root_topic}/#{region}" if region == '#'
|
82
83
|
puts "Subscribing to: #{full_topic}"
|
83
84
|
mqtt_obj.subscribe(full_topic, qos)
|
@@ -276,7 +277,7 @@ module Meshtastic
|
|
276
277
|
mqtt_obj: 'required - mqtt_obj object returned from #connect method',
|
277
278
|
root_topic: 'optional - root topic (default: msh)',
|
278
279
|
region: 'optional - region e.g. 'US/VA', etc (default: US)',
|
279
|
-
|
280
|
+
channel_topic: 'optional - channel ID path e.g. '2/stat/#' (default: '2/e/LongFast/#')',
|
280
281
|
psks: 'optional - hash of :channel_id => psk key value pairs (default: { LongFast: 'AQ==' })',
|
281
282
|
qos: 'optional - quality of service (default: 0)',
|
282
283
|
json: 'optional - JSON output (default: false)',
|
data/lib/meshtastic/version.rb
CHANGED