def SyncRadioStation(self):
radioURI = html.escape(self.CurrentURI) #escape the uri for &
LogMessage("Current radio URI: " + radioURI)
radioStationFound = False
for k,v in self.radioFavorites.items():
if radioURI == html.escape(v): #if CurrentURI is found in the values of the radio favorites dict
LogMessage('Radio station found in favorites list, updating radio switch selector')
dictOptions = Devices[4].Options
listLevelNames = dictOptions['LevelNames'].split('|')
radioLevel = (listLevelNames.index(k))*10 #get the index and multiply it with 10 to get the level of selector switch
self.sonosRadio = radioLevel
UpdateDevice(4, 1, str(self.sonosRadio))
radioStationFound = True
###self.SyncDevices()
if radioStationFound == False:
LogMessage('Radio station not found in favorites list, updating radio switch selector')
self.sonosRadio = 0
UpdateDevice(4, 1, str(self.sonosRadio))
return
# Make sure that the Domoticz devices are in sync
评论列表
文章目录