temperature_converter_EmielEst 1.0.8 → 1.0.9
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/bin/temp-conv +11 -9
- data/lib/mqtt_reader.rb +17 -0
- data/lib/temperature_converter_EmielEst.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 48a295d5e302f0cf493c22bc80a2d52b204149be
|
|
4
|
+
data.tar.gz: bd9b74d3a7c6776f6a19a4259903a00e476f2cf9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e0fa8bfab438154b4e8955cb8c5cbb2883e0a1fa75edcdba68cb7afe5e5cb1a755929e60c6ec04b4bcf0b8aab9195936a841684a598709fd4fdd56eac09e7506
|
|
7
|
+
data.tar.gz: f3b5d9b94eecdd0495445a4cb96c8469025a9352bc33d91d109035f7e73678bc17853b17753290f1754423b171a15d2451dfa590821645cf767a09cb5f9e6977
|
data/bin/temp-conv
CHANGED
|
@@ -9,6 +9,7 @@ require 'url_reader.rb'
|
|
|
9
9
|
require 'text_printer.rb'
|
|
10
10
|
require 'json_printer.rb'
|
|
11
11
|
require 'html_printer.rb'
|
|
12
|
+
require 'mqtt_reader.rb'
|
|
12
13
|
|
|
13
14
|
globalTemperature = 0
|
|
14
15
|
path = 'C:\Users\Gebruiker\Documents\School\systeem\Oefenigen\01 Temp converter\temperatuur.txt'
|
|
@@ -47,15 +48,16 @@ end
|
|
|
47
48
|
|
|
48
49
|
opts.on("-m","--mqtt", "temperature van mqtt") do
|
|
49
50
|
|
|
50
|
-
client.host = 'staging.thethingsnetwork.org'
|
|
51
|
-
client.port = '1883'
|
|
52
|
-
client.username = '70B3D57ED00012B2'
|
|
53
|
-
client.password = 'c8iuTSccnypK1eoFzEb/OoqB2FVAiFg/aEaYesnNf4w='
|
|
54
|
-
client.connect
|
|
55
|
-
c = 0
|
|
56
|
-
topic, message=client.get('70B3D57ED00012B2/devices/00000000AE6C63E4/up')
|
|
57
|
-
|
|
58
|
-
puts mqtttemperature = JSON.parse(message)['fields']['temperature']
|
|
51
|
+
# client.host = 'staging.thethingsnetwork.org'
|
|
52
|
+
# client.port = '1883'
|
|
53
|
+
# client.username = '70B3D57ED00012B2'
|
|
54
|
+
# client.password = 'c8iuTSccnypK1eoFzEb/OoqB2FVAiFg/aEaYesnNf4w='
|
|
55
|
+
# client.connect
|
|
56
|
+
# c = 0
|
|
57
|
+
# topic, message=client.get('70B3D57ED00012B2/devices/00000000AE6C63E4/up')
|
|
58
|
+
#
|
|
59
|
+
# puts mqtttemperature = JSON.parse(message)['fields']['temperature']
|
|
60
|
+
mqtttemperature = MqttReader.read()
|
|
59
61
|
c = mqtttemperature.to_f
|
|
60
62
|
end
|
|
61
63
|
|
data/lib/mqtt_reader.rb
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
require 'mqtt'
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class MqttReader
|
|
5
|
+
def self.read()
|
|
6
|
+
client = MQTT::Client.new
|
|
7
|
+
client.host = 'staging.thethingsnetwork.org'
|
|
8
|
+
client.port = '1883'
|
|
9
|
+
client.username = '70B3D57ED00012B2'
|
|
10
|
+
client.password = 'c8iuTSccnypK1eoFzEb/OoqB2FVAiFg/aEaYesnNf4w='
|
|
11
|
+
client.connect
|
|
12
|
+
c = 0
|
|
13
|
+
topic, message=client.get('70B3D57ED00012B2/devices/00000000AE6C63E4/up')
|
|
14
|
+
|
|
15
|
+
return JSON.parse(message)['fields']['temperature']
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require 'text_reader.rb'
|
|
2
|
+
require 'mqtt_reader.rb'
|
|
2
3
|
require 'url_reader.rb'
|
|
3
4
|
require 'text_printer.rb'
|
|
4
5
|
require 'json_printer.rb'
|
|
@@ -7,6 +8,5 @@ require 'temp_converter.rb'
|
|
|
7
8
|
require 'net/http'
|
|
8
9
|
require 'uri'
|
|
9
10
|
require 'rubygems'
|
|
10
|
-
require 'mqtt'
|
|
11
11
|
require 'json'
|
|
12
12
|
require 'optparse'
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: temperature_converter_EmielEst
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.9
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Emiel
|
|
@@ -20,6 +20,7 @@ files:
|
|
|
20
20
|
- bin/temp-conv
|
|
21
21
|
- lib/html_printer.rb
|
|
22
22
|
- lib/json_printer.rb
|
|
23
|
+
- lib/mqtt_reader.rb
|
|
23
24
|
- lib/temp_converter.rb
|
|
24
25
|
- lib/temperature_converter_EmielEst.rb
|
|
25
26
|
- lib/text_printer.rb
|