Skip to content

Commit

Permalink
Fixed issue with capitalisation of commands
Browse files Browse the repository at this point in the history
  • Loading branch information
RogerSelwyn committed May 4, 2020
1 parent dbe0ff0 commit 47e826e
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions pyskyqremote/skyq_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,20 +319,16 @@ def press(self, sequence):
"""Issue the specified sequence of commands to SkyQ box."""
if isinstance(sequence, list):
for item in sequence:
if item not in self.commands:
_LOGGER.error(
"E0010 - Invalid command: {self._host} : {0}".format(item)
)
if item.casefold() not in self.commands:
_LOGGER.error(f"E0010 - Invalid command: {self._host} : {item}")
break
self._sendCommand(self.commands[item.casefold()])
time.sleep(0.5)
else:
if sequence not in self.commands:
_LOGGER.error(
"E0020 - Invalid command: {self._host} : {0}".format(sequence)
)
_LOGGER.error(f"E0020 - Invalid command: {self._host} : {sequence}")
else:
self._sendCommand(self.commands[sequence])
self._sendCommand(self.commands[sequence.casefold()])

def _http_json(self, path, headers=None) -> str:
response = requests.get(
Expand Down

0 comments on commit 47e826e

Please sign in to comment.