lib/milight/v6/command.rb in milight-v6-0.1.0 vs lib/milight/v6/command.rb in milight-v6-0.1.1
- old
+ new
@@ -1,12 +1,13 @@
# frozen_string_literal: true
+require "milight/v6/exception"
require "milight/v6/socket"
module Milight
module V6
- # see http://www.limitlessled.com/dev/
+ # see https://github.com/Fantasmos/LimitlessLED-DevAPI
class Command
def initialize(host, port = 5987)
@socket = Milight::V6::Socket.new(host, port)
bridge_session
@@ -80,9 +81,11 @@
0xED, 0xA3, 0x01, 0xAE, 0x08, 0x2D, 0x46, 0x61, 0x41,
0xA7, 0xF6, 0xDC, 0xAF, 0xD3, 0xE6, 0x00, 0x00, 0x1E]
@socket.send_bytes(request)
response = @socket.receive_bytes
+
+ raise Exception, "Could not establish session with Wifi bridge." unless response
@session_id1 = response[19]
@session_id2 = response[20]
end