File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -417,10 +417,16 @@ def check_power(self):
417417 err = response [0x22 ] | (response [0x23 ] << 8 )
418418 if err == 0 :
419419 payload = self .decrypt (bytes (response [0x38 :]))
420- if ord (payload [0x4 ]) == 1 or ord (payload [0x4 ]) == 3 :
421- state = True
420+ if type (payload [0x4 ]) == int :
421+ if payload [0x4 ] == 1 or payload [0x4 ] == 3 :
422+ state = True
423+ else :
424+ state = False
422425 else :
423- state = False
426+ if ord (payload [0x4 ]) == 1 or ord (payload [0x4 ]) == 3 :
427+ state = True
428+ else :
429+ state = False
424430 return state
425431
426432 def check_nightlight (self ):
@@ -431,10 +437,16 @@ def check_nightlight(self):
431437 err = response [0x22 ] | (response [0x23 ] << 8 )
432438 if err == 0 :
433439 payload = self .decrypt (bytes (response [0x38 :]))
434- if ord (payload [0x4 ]) == 2 or ord (payload [0x4 ]) == 3 :
435- state = True
440+ if type (payload [0x4 ]) == int :
441+ if payload [0x4 ] == 2 or payload [0x4 ] == 3 :
442+ state = True
443+ else :
444+ state = False
436445 else :
437- state = False
446+ if ord (payload [0x4 ]) == 2 or ord (payload [0x4 ]) == 3 :
447+ state = True
448+ else :
449+ state = False
438450 return state
439451
440452 def get_energy (self ):
You can’t perform that action at this time.
0 commit comments