Add files via upload

This commit is contained in:
LukeSpad 2022-07-29 19:26:33 +01:00 committed by GitHub
parent 0fb28405cd
commit 48c59ce5ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 17 additions and 8 deletions

View file

@ -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())

View file

@ -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()

View file

@ -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()

View file

@ -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

View file

@ -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
)

View file

@ -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()