Skip to content

Commit

Permalink
Change plugin file name to YamahaRX
Browse files Browse the repository at this point in the history
Remove space from plugin file name.
  • Loading branch information
autolog committed Sep 30, 2023
1 parent 6fa700f commit 028284b
Show file tree
Hide file tree
Showing 27 changed files with 500 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ pip-log.txt
#Mr Developer
.mr.developer.cfg
.idea/
.DS_Store
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>PluginVersion</key>
<string>2022.0.2</string>
<string>2022.0.3</string>
<key>ServerApiVersion</key>
<string>3.0</string>
<key>IwsApiVersion</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
from rxv import exceptions as rxv_exceptions

try:
import xml.etree.cElementTree as ET
import xml.etree.cElementTree as et
except ImportError:
import xml.etree.ElementTree as ET
import xml.etree.ElementTree as et

from xml.etree.ElementTree import ParseError

Expand Down Expand Up @@ -64,7 +64,7 @@ def xmitToReceiver(dev, xml_string):
headers={'Content-Type': 'application/xml'})
resp = urllib.request.urlopen(req)
status_xml = resp.read()
root = ET.fromstring(status_xml)
root = et.fromstring(status_xml)
return root

@staticmethod
Expand Down Expand Up @@ -139,14 +139,15 @@ def __init__(self, pluginId, pluginDisplayName, pluginVersion, pluginPrefs):
indigo.PluginBase.__init__(self, pluginId, pluginDisplayName, pluginVersion, pluginPrefs)
self.debug = pluginPrefs.get("showDebugInfo", False)
self.devices = {}
self.refresh_receiver_list()

##################################
# Standard plugin operation methods
##################################
def startup(self):
self.logger.debug("startup called")

self.refresh_receiver_list()

def shutdown(self):
self.logger.debug("shutdown called")

Expand Down Expand Up @@ -268,7 +269,8 @@ def updateStatus(self, dev_id):
root = ClassicReceiver.xmitToReceiver(dev, xml_string)
power = root.find("./Main_Zone/Basic_Status/Power_Control/Power").text
sleep = root.find("./Main_Zone/Basic_Status/Power_Control/Sleep").text
if(sleep!='Off'): sleep = "n"+sleep
if sleep != 'Off':
sleep = "n"+sleep
volume = root.find("./Main_Zone/Basic_Status/Vol/Lvl/Val").text
mute = root.find("./Main_Zone/Basic_Status/Vol/Mute").text
inputmode = root.find("./Main_Zone/Basic_Status/Input/Input_Sel").text
Expand Down Expand Up @@ -346,18 +348,18 @@ def _set_rxv_property(self, dev, property, value):
self.logger.debug(f"device '{dev.name}' had a connection error")
self.logger.error(f"device '{dev.name}' is unavailable")
except rxv_exceptions.ResponseException as e:
response = ET.XML(str(e))
response = et.XML(str(e))
if response.get("RC") == "3":
# RC 3 is what happens when you issue a command that's not valid - wrong menu navigation direction, etc.
# We just skip it.
pass
elif response.get("RC") != "4":
self.logger.error(f"device '{dev.name}' can't have property '{property}' set to value '{str(value)}'")
else:
# RC 4 is what happens when the amp is offline or in standby and you try to send it a command other than
# RC 4 is what happens when the amp is offline or in standby, and you try to send it a command other than
# to turn on (if in standby)
self.logger.error(f"device '{dev.name}' is unavailable")
except ET.ParseError:
except et.ParseError:
# dev.setErrorStateOnServer('unavailable')
# self.logger.debug(f"device '{dev.name}' failed to update status with an XML parse error")
# This seems to happen relatively frequently - apparently sometimes the amp goes out to lunch for
Expand Down
Loading

0 comments on commit 028284b

Please sign in to comment.