plugin.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:sonos 作者: gerard33 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号