diff --git a/BeoGateway.indigoPlugin/Contents/Server Plugin/Resources/ASBridge.py b/BeoGateway.indigoPlugin/Contents/Server Plugin/Resources/ASBridge.py index bf39bae..ec843ab 100644 --- a/BeoGateway.indigoPlugin/Contents/Server Plugin/Resources/ASBridge.py +++ b/BeoGateway.indigoPlugin/Contents/Server Plugin/Resources/ASBridge.py @@ -118,7 +118,7 @@ class MusicController(object): playlist.playOnce_(None) def get_playlist_names(self): - playlists = [] + playlists = ["None"] # Generate and return a list of playlists in Apple Music for playlist in self.app.sources().objectWithName_("Library").playlists(): playlists.append(playlist.name()) diff --git a/BeoGateway.indigoPlugin/Contents/Server Plugin/Resources/BLHIP_CLIENT.py b/BeoGateway.indigoPlugin/Contents/Server Plugin/Resources/BLHIP_CLIENT.py index 5b84e43..238e7fb 100644 --- a/BeoGateway.indigoPlugin/Contents/Server Plugin/Resources/BLHIP_CLIENT.py +++ b/BeoGateway.indigoPlugin/Contents/Server Plugin/Resources/BLHIP_CLIENT.py @@ -192,7 +192,7 @@ class BLHIPClient(asynchat.async_chat): def send_cmd(self, telegram): try: - self.push(telegram.encode("ascii") + "\r\n") + self.push(str(telegram + "\r\n")) except socket.timeout as e: indigo.server.log("\tSocket connection timed out: " + str(e), level=logging.ERROR) self.handle_close() diff --git a/BeoGateway.indigoPlugin/Contents/Server Plugin/Resources/MLCLI_CLIENT.py b/BeoGateway.indigoPlugin/Contents/Server Plugin/Resources/MLCLI_CLIENT.py index c2e113d..2e0346d 100644 --- a/BeoGateway.indigoPlugin/Contents/Server Plugin/Resources/MLCLI_CLIENT.py +++ b/BeoGateway.indigoPlugin/Contents/Server Plugin/Resources/MLCLI_CLIENT.py @@ -135,7 +135,7 @@ class MLCLIClient(asynchat.async_chat): def send_cmd(self, telegram): try: - self.push(telegram + "\r\n") + self.push(str(telegram + "\r\n")) except socket.timeout as e: indigo.server.log("\tSocket connection timed out: " + str(e), level=logging.ERROR) self.handle_close() diff --git a/BeoGateway.indigoPlugin/Contents/Server Plugin/Resources/MLCONFIG.py b/BeoGateway.indigoPlugin/Contents/Server Plugin/Resources/MLCONFIG.py index 7c5f609..7202499 100644 --- a/BeoGateway.indigoPlugin/Contents/Server Plugin/Resources/MLCONFIG.py +++ b/BeoGateway.indigoPlugin/Contents/Server Plugin/Resources/MLCONFIG.py @@ -23,7 +23,7 @@ class MLConfig: def _download_data(self): try: indigo.server.log('Downloading configuration data from Gateway...', level=logging.WARNING) - url = 'http://' + self._host + '/mlgwpservices.json' + url = 'http://' + str(self._host) + '/mlgwpservices.json' # try Basic Auth next (this is needed for the BLGW) response = requests.get(url, auth=HTTPBasicAuth(self._user, self._pwd)) @@ -104,6 +104,7 @@ class MLConfig: room['Room_Name'] = str(zone['name']).split('/')[1] elif gateway_type == 'mlgw': # MLGW has no zoning concept - devices are arranged in rooms only + room['Zone'] = 'NA' room['Room_Name'] = str(zone['name']) # Get products diff --git a/BeoGateway.indigoPlugin/Contents/Server Plugin/Resources/MLGW_CLIENT.py b/BeoGateway.indigoPlugin/Contents/Server Plugin/Resources/MLGW_CLIENT.py index 69fdea3..5e83bd4 100644 --- a/BeoGateway.indigoPlugin/Contents/Server Plugin/Resources/MLGW_CLIENT.py +++ b/BeoGateway.indigoPlugin/Contents/Server Plugin/Resources/MLGW_CLIENT.py @@ -240,6 +240,14 @@ class MLGWClient(asynchat.async_chat): for p in payload: telegram.append(p) + # Convert telegram to byte string + # b_telegram = b'' + # for t in telegram: + # if type(t) == int: + # b_telegram += (t).to_bytes(1, byteorder='little') + # else: + # b_telegram += bytes(t, 'ascii') + try: self.push(str(bytearray(telegram))) except socket.timeout as e: @@ -249,14 +257,14 @@ class MLGWClient(asynchat.async_chat): indigo.server.log("Error sending data: " + str(e), level=logging.ERROR) self.handle_close() else: - self.last_sent = str(bytearray(telegram)) + self.last_sent = str(list(telegram)) self.last_sent_at = time.time() if msg_type != CONST.MLGW_PL.get("PING"): indigo.server.log( self.name + " >>-SENT--> " + self._getpayloadtypestr(msg_type) + ": " - + str(list(telegram)), + + self.last_sent, level=logging.INFO) else: if self.debug: @@ -264,7 +272,7 @@ class MLGWClient(asynchat.async_chat): self.name + " >>-SENT--> " + self._getpayloadtypestr(msg_type) + ": " - + str(list(telegram)), + + self.last_sent, level=logging.DEBUG ) diff --git a/BeoGateway.indigoPlugin/Contents/Server Plugin/Resources/MLtn_CLIENT.py b/BeoGateway.indigoPlugin/Contents/Server Plugin/Resources/MLtn_CLIENT.py index 1cd108f..6a873b7 100644 --- a/BeoGateway.indigoPlugin/Contents/Server Plugin/Resources/MLtn_CLIENT.py +++ b/BeoGateway.indigoPlugin/Contents/Server Plugin/Resources/MLtn_CLIENT.py @@ -310,7 +310,7 @@ class MLtnClient(asynchat.async_chat): def _send_cmd(self, telegram): try: - self.push(telegram + "\r\n") + self.push(str(telegram + "\r\n")) except socket.timeout as e: indigo.server.log("\tSocket connection timed out: " + str(e), level=logging.ERROR) self.handle_close()