Class: MqttReader
- Inherits:
-
Object
- Object
- MqttReader
- Defined in:
- lib/mqtt_reader.rb
Class Method Summary collapse
-
.mqtt_open(host, port, username, password) ⇒ Object
Reads temperature in degrees celcius from MQTT.
Class Method Details
.mqtt_open(host, port, username, password) ⇒ Object
Reads temperature in degrees celcius from MQTT
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/mqtt_reader.rb', line 8 def self.mqtt_open(host, port, username, password) client = MQTT::Client.new client.host = host client.port = port client.username = username client.password = password client.connect() topic, = client.get('70B3D57ED00012B2/devices/00000000AE6C63E4/up') tuid = JSON.parse()['fields']['temperature'].to_f end |