Closed davidspek closed 3 years ago
I have gotten further with fixing this issue by properly handling integers. Passing command_to_iscp('subwoofer-temporary-level', '20', zone='main')
now returns 'SWL14'
as expect. There was another error in ValueRange where the highest value was being removed, thus resulting in an error when command_to_iscp('subwoofer-temporary-level', '24', zone='main')
or command_to_iscp('master-volume', '200', zone='main')
was called. This has now been fixed so the actual maximum values are present in ValueRange. Once I fix the handling of negative integers and have subwoofer-temporary-level working I will create a pull request.
While trying to fix the handling of
subwoofer-temporary-level
I found a rather peculiar issue regardingcommand_to_iscp
. Whilereceiver.command('master-volume=160')
,receiver.command('master-volume 160')
,receiver.command('volume=160')
andreceiver.command('volume 160')
all work correctly. Executing the command according to the documentation usingreceiver.command('master-volume', 110, 'main')
will result in the following error:Alternatively, when using passing the volume level as a string the conversion to hexadecimal fails for double digit numbers.
receiver.command('master-volume', '9', 'main')
results in response('master-volume', 9)
receiver.command('master-volume', '10', 'main')
results in response('master-volume', 1)
I had already noticed this while trying to debug what is causing
subwoofer-temporary-level
to returnN/A
.command_to_iscp('subwoofer-temporary-level', '9', zone='main')
returns'SWL09'
command_to_iscp('subwoofer-temporary-level', '10', zone='main')
returns'SWL01'
command_to_iscp('subwoofer-temporary-level', '15', zone='main')
returns'SWL01'
command_to_iscp('subwoofer-temporary-level', '20', zone='main')
returns'SWL02'
As you can see, the command_to_iscp funciton is incapable of handling integers, and for strings it is incorrectly splitting them resulting in an incorrect hexadecimal value being created.