Skip to content

Commit

Permalink
Merge pull request #2 from JohNan/JohNan-patch-1
Browse files Browse the repository at this point in the history
Fixes crashes when ssid is not set and battery timestamp
  • Loading branch information
JohNan authored Sep 28, 2023
2 parents 65be026 + 7348637 commit 1e5347a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pyflichub/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
class FlicButton():
def __init__(self, bdaddr: str, serial_number: str, color: str, name: str, active_disconnect: bool, connected: bool,
ready: bool, battery_status: int, uuid: str, flic_version: int, firmware_version: int, key: str,
passive_mode: bool, battery_timestamp: datetime) -> None:
passive_mode: bool, battery_timestamp: datetime = None) -> None:
self.bdaddr = bdaddr
self.serial_number = serial_number
self.color = color
Expand Down
6 changes: 4 additions & 2 deletions pyflichub/flichub.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ def __init__(self, state, ssid):
self.ssid = ssid


def _decode_ssid(ssid_list):
return ''.join(chr(byte) for byte in ssid_list)
def _decode_ssid(ssid):
if ssid is None:
return None
return ''.join(chr(byte) for byte in ssid)


class FlicHubInfo:
Expand Down

0 comments on commit 1e5347a

Please sign in to comment.