class M2X::MQTT
Constants
- VERSION
Attributes
client[RW]
Public Class Methods
new(api_key, options={})
click to toggle source
# File lib/m2x/mqtt.rb, line 14 def initialize(api_key, options={}) @api_key = api_key @options = options end
Public Instance Methods
create_device(attributes)
click to toggle source
# File lib/m2x/mqtt.rb, line 43 def create_device(attributes) M2X::MQTT::Device.create!(client, attributes) end
device(id)
click to toggle source
# File lib/m2x/mqtt.rb, line 39 def device(id) M2X::MQTT::Device.new(client, "id" => id) end
distribution(id)
click to toggle source
# File lib/m2x/mqtt.rb, line 47 def distribution(id) M2X::MQTT::Distribution.new(client, "id" => id) end
status()
click to toggle source
stream(device_id, name)
click to toggle source
# File lib/m2x/mqtt.rb, line 51 def stream(device_id, name) M2X::MQTT::Stream.new(client, device(device_id), "name" => name) end
time()
click to toggle source
# File lib/m2x/mqtt.rb, line 33 def time client.subscribe client.get("/time") client.get_response["body"] end