ol-iver / denonavr

Automation Library for Denon AVR receivers.
MIT License
174 stars 66 forks source link

Unable to access a powered off device since Audyssey settings were added #173

Closed sbraz closed 3 years ago

sbraz commented 3 years ago

Hi, Since @MarBra committed 28fd5ade52a498283774845b5f9d2cef54f7fefe, I am no longer able to power on my device using code like this:

import denonavr
host = "192.168.0.100"
c = denonavr.DenonAVR(host)
c.power_on()

It results in

Traceback (most recent call last):
  File "test.py", line 3, in <module>
    c = denonavr.DenonAVR(host)
  File "/tmp/denon/denonavr/denonavr/denonavr.py", line 344, in __init__
    self.update()
  File "/tmp/denon/denonavr/denonavr/denonavr.py", line 518, in update
    self.ensure_configuration()
  File "/tmp/denon/denonavr/denonavr/denonavr.py", line 510, in ensure_configuration
    self._support_update_avr_2016 = support_avr_2016.result()
  File "/usr/lib/python3.7/concurrent/futures/_base.py", line 435, in result
    return self.__get_result()
  File "/usr/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
  File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/tmp/denon/denonavr/denonavr/denonavr.py", line 638, in _update_avr_2016
    executor.submit(self._audyssey.update())
  File "/tmp/denon/denonavr/denonavr/audyssey.py", line 100, in update
    self.dynamiceq = bool(int(param.text))
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
sbraz commented 3 years ago

Maybe the following naive fix is enough?

diff --git a/denonavr/audyssey.py b/denonavr/audyssey.py
index ca3f30a..6c833d8 100644
--- a/denonavr/audyssey.py
+++ b/denonavr/audyssey.py
@@ -105,7 +105,7 @@ class Audyssey:
                 continue
             if param.get("name") == "multeq":
                 self.multeq = MULTI_EQ_MAP.get(param.text)
-            elif param.get("name") == "dynamiceq":
+            elif param.get("name") == "dynamiceq" and param.text is not None:
                 self.dynamiceq = bool(int(param.text))
             elif param.get("name") == "reflevoffset":
                 # Reference level offset can only be used with DynamicEQ
JPHutchins commented 3 years ago

Yes, the naive fix is enough, see PR https://github.com/scarface-4711/denonavr/pull/171

ol-iver commented 3 years ago

Fixed with this commit https://github.com/scarface-4711/denonavr/commit/b073203039f1bf2a4b45cd48fd4e9ce298f1f34d and added to HA in this PR https://github.com/home-assistant/core/pull/44194