Skip to content

Commit

Permalink
Change input type check to check for HA sublasses of core types using…
Browse files Browse the repository at this point in the history
… issubclass
  • Loading branch information
jslove committed Dec 17, 2023
1 parent 6655fbb commit 6d48d33
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,9 @@ def parse_source(self, srcs):
"Split into input unit, input #, expansion bus, expansion bus group"
for src in srcs:
inpdict={'UNIT':0,'CHAN':None,'BUS':None, 'BUSGRP':'E', 'INPGRP':'I'}
if type(src) is int:
if issubclass(type(src), int):
inpdict['CHAN'] = src
elif type(src) is str:
elif issubclass(type(src), str):
if ":" in src:
comps = src.count(':')
if comps == 1:
Expand Down Expand Up @@ -396,10 +396,10 @@ def __str__(self):

def parse_output(self, output):
"Returns (unit,output) "
if type(output) is int:
if issubclass(type(output), int):
XUNIT = 0
XOUT = output
elif type(output) is str:
elif issubclass(type(output), str):
if ":" in output:
XUNIT, XOUT = output.split(":")
elif output.isdigit():
Expand Down Expand Up @@ -432,7 +432,7 @@ def select_source(self, source):
_LOGGER.debug('Turned off actsrc: {}'.format(actsrc))
if source != SRC_OFF: #and source in self._sources:
XIN, XINGRP = self._sources[source].getSource(XUNIT, cnt)
ON = 3 if (type(XIN) is int and XIN <= (self._xapx00.matrixGeo-4)) else 1
ON = 3 if (issubclass(type(XIN), int) and XIN <= (self._xapx00.matrixGeo-4)) else 1
# if a mike input on=3, if line on=1, last 4 inputs are line
self._xapx00.setMatrixRouting(XIN, XOUT, ON, inGroup = XINGRP, unitCode = XUNIT)
self._poweroff_source = source # in case turn_on called without calling turn_off
Expand Down

0 comments on commit 6d48d33

Please sign in to comment.