Skip to content

Commit

Permalink
Fix typing of mac
Browse files Browse the repository at this point in the history
  • Loading branch information
Ernst committed Nov 8, 2024
1 parent 4c6acba commit 5aaee29
Show file tree
Hide file tree
Showing 36 changed files with 36 additions and 36 deletions.
2 changes: 1 addition & 1 deletion custom_components/ble_monitor/ble_parser/acconeer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
}


def parse_acconeer(self, data: bytes, mac: str):
def parse_acconeer(self, data: bytes, mac: bytes):
"""Acconeer parser"""
msg_length = len(data)
firmware = "Acconeer"
Expand Down
2 changes: 1 addition & 1 deletion custom_components/ble_monitor/ble_parser/airmentor.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def parse_2s(msg_type, xvalue):
return None


def parse_airmentor(self, data: bytes, mac: str):
def parse_airmentor(self, data: bytes, mac: bytes):
"""Parser for Air Mentor"""
data_length = len(data)

Expand Down
2 changes: 1 addition & 1 deletion custom_components/ble_monitor/ble_parser/almendo.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
_LOGGER = logging.getLogger(__name__)


def parse_almendo(self, data: bytes, mac: str):
def parse_almendo(self, data: bytes, mac: bytes):
"""Almendo parser"""
result = {
"mac": to_unformatted_mac(mac),
Expand Down
2 changes: 1 addition & 1 deletion custom_components/ble_monitor/ble_parser/altbeacon.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
DEVICE_TYPE: Final = "AltBeacon"


def parse_altbeacon(self, data: str, comp_id: int, mac: str):
def parse_altbeacon(self, data: bytes, comp_id: int, mac: bytes):
"""parser for Alt Beacon"""
if len(data) >= 27:
uuid = data[6:22]
Expand Down
2 changes: 1 addition & 1 deletion custom_components/ble_monitor/ble_parser/amazfit.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
_LOGGER = logging.getLogger(__name__)


def parse_amazfit(self, service_data: str, man_spec_data: str, mac: str):
def parse_amazfit(self, service_data: str | None, man_spec_data: str, mac: bytes):
"""parser for Amazfit scale and Miband 4 and 5"""
if service_data:
service_data_length = len(service_data)
Expand Down
2 changes: 1 addition & 1 deletion custom_components/ble_monitor/ble_parser/atc.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
_LOGGER = logging.getLogger(__name__)


def parse_atc(self, data: bytes, mac: str):
def parse_atc(self, data: bytes, mac: bytes):
"""Parse ATC BLE advertisements"""
device_type = "ATC"
msg_length = len(data)
Expand Down
2 changes: 1 addition & 1 deletion custom_components/ble_monitor/ble_parser/bluemaestro.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
_LOGGER = logging.getLogger(__name__)


def parse_bluemaestro(self, data: bytes, mac: str):
def parse_bluemaestro(self, data: bytes, mac: bytes):
"""Parse BlueMaestro advertisement."""
msg_length = len(data)
firmware = "BlueMaestro"
Expand Down
2 changes: 1 addition & 1 deletion custom_components/ble_monitor/ble_parser/blustream.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
_LOGGER = logging.getLogger(__name__)


def parse_blustream(self, data: bytes, mac: str):
def parse_blustream(self, data: bytes, mac: bytes):
"""Parse Blustream advertisement."""
msg_length = len(data)
firmware = "Blustream"
Expand Down
2 changes: 1 addition & 1 deletion custom_components/ble_monitor/ble_parser/bparasite.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
_LOGGER = logging.getLogger(__name__)


def parse_bparasite(self, data: bytes, mac: str):
def parse_bparasite(self, data: bytes, mac: bytes):
"""Check for adstruc length"""
msg_length = len(data)
if msg_length == 22: # TODO: Use protocol bits?
Expand Down
2 changes: 1 addition & 1 deletion custom_components/ble_monitor/ble_parser/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from uuid import UUID


def to_uuid(uuid: str) -> str:
def to_uuid(uuid: bytes) -> str:
"""Return formatted UUID"""
return str(UUID(''.join(f'{i:02X}' for i in uuid)))

Expand Down
2 changes: 1 addition & 1 deletion custom_components/ble_monitor/ble_parser/ibeacon.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
DEVICE_TYPE: Final = "iBeacon"


def parse_ibeacon(self, data: str, mac: str):
def parse_ibeacon(self, data: bytes, mac: bytes):
"""Parse iBeacon advertisements"""
if data[5] == 0x15 and len(data) >= 27:
uuid = data[6:22]
Expand Down
2 changes: 1 addition & 1 deletion custom_components/ble_monitor/ble_parser/inkbird.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def convert_temperature(temp):
return temperature


def parse_inkbird(self, data: bytes, complete_local_name: str, mac: str):
def parse_inkbird(self, data: bytes, complete_local_name: str, mac: bytes):
"""Inkbird parser"""
msg_length = len(data)
firmware = "Inkbird"
Expand Down
2 changes: 1 addition & 1 deletion custom_components/ble_monitor/ble_parser/inode.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def adj_acc(acc):
return acc


def parse_inode(self, data: bytes, mac: str):
def parse_inode(self, data: bytes, mac: bytes):
"""iNode parser"""
msg_length = len(data)
firmware = "iNode"
Expand Down
2 changes: 1 addition & 1 deletion custom_components/ble_monitor/ble_parser/jaalee.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
_LOGGER = logging.getLogger(__name__)


def parse_jaalee(self, data: bytes, mac: str):
def parse_jaalee(self, data: bytes, mac: bytes):
"""Jaalee parser"""
msg_length = len(data)
firmware = "Jaalee"
Expand Down
2 changes: 1 addition & 1 deletion custom_components/ble_monitor/ble_parser/jinou.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
_LOGGER = logging.getLogger(__name__)


def parse_jinou(self, data: bytes, mac: str):
def parse_jinou(self, data: bytes, mac: bytes):
"""Jinou parser"""
msg_length = len(data)
firmware = "Jinou"
Expand Down
2 changes: 1 addition & 1 deletion custom_components/ble_monitor/ble_parser/kegtron.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
}


def parse_kegtron(self, data: bytes, mac: str):
def parse_kegtron(self, data: bytes, mac: bytes):
"""Parser for Kegtron sensors"""
msg_length = len(data)
if msg_length == 31:
Expand Down
2 changes: 1 addition & 1 deletion custom_components/ble_monitor/ble_parser/kkm.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
_LOGGER = logging.getLogger(__name__)


def parse_kkm(self, data: bytes, mac: str):
def parse_kkm(self, data: bytes, mac: bytes):
"""Parser for KKM sensors."""
device_type = "K6 Sensor Beacon"
result = {
Expand Down
2 changes: 1 addition & 1 deletion custom_components/ble_monitor/ble_parser/laica.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def read_impedance(data):
return impedance


def parse_laica(self, data: bytes, mac: str):
def parse_laica(self, data: bytes, mac: bytes):
"""Parser for Laica sensors"""
xvalue = data[4:]

Expand Down
2 changes: 1 addition & 1 deletion custom_components/ble_monitor/ble_parser/mikrotik.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def convert_8_8_to_float(val_1, val_2):
return val_1 + (val_2 / 256)


def parse_mikrotik(self, data: bytes, mac: str):
def parse_mikrotik(self, data: bytes, mac: bytes):
"""Inkbird parser"""
msg_length = len(data)
firmware = "Mikrotik"
Expand Down
2 changes: 1 addition & 1 deletion custom_components/ble_monitor/ble_parser/miscale.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
_LOGGER = logging.getLogger(__name__)


def parse_miscale(self, data: bytes, mac: str):
def parse_miscale(self, data: bytes, mac: bytes):
"""Parser for Xiaomi Mi Scales."""
msg_length = len(data)
uuid16 = (data[3] << 8) | data[2]
Expand Down
2 changes: 1 addition & 1 deletion custom_components/ble_monitor/ble_parser/moat.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
_LOGGER = logging.getLogger(__name__)


def parse_moat(self, data: bytes, mac: str):
def parse_moat(self, data: bytes, mac: bytes):
"""Parser for Moat sensors"""
msg_length = len(data)
firmware = "Moat"
Expand Down
2 changes: 1 addition & 1 deletion custom_components/ble_monitor/ble_parser/oral_b.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
}


def parse_oral_b(self, data: bytes, mac: str):
def parse_oral_b(self, data: bytes, mac: bytes):
"""Parser for Oral-B toothbrush."""
msg_length = len(data)
firmware = "Oral-B"
Expand Down
2 changes: 1 addition & 1 deletion custom_components/ble_monitor/ble_parser/oras.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
}


def parse_oras(self, data: bytes, mac: str):
def parse_oras(self, data: bytes, mac: bytes):
"""Parser for Oras toothbrush or Garnet tank."""
msg_length = len(data)
result = {"mac": to_unformatted_mac(mac)}
Expand Down
2 changes: 1 addition & 1 deletion custom_components/ble_monitor/ble_parser/qingping.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
_LOGGER = logging.getLogger(__name__)


def parse_qingping(self, data: bytes, mac: str):
def parse_qingping(self, data: bytes, mac: bytes):
"""Qingping parser"""
msg_length = len(data)
if msg_length > 12:
Expand Down
2 changes: 1 addition & 1 deletion custom_components/ble_monitor/ble_parser/ruuvitag.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
_LOGGER = logging.getLogger(__name__)


def parse_ruuvitag(self, data: bytes, mac: str):
def parse_ruuvitag(self, data: bytes, mac: bytes):
"""Ruuvitag parser"""
device_type = "Ruuvitag"
result = {
Expand Down
2 changes: 1 addition & 1 deletion custom_components/ble_monitor/ble_parser/sensirion.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
]


def parse_sensirion(self, data: bytes, complete_local_name: str, mac: str):
def parse_sensirion(self, data: bytes, complete_local_name: str, mac: bytes):
"""Sensirion parser"""
result = {"firmware": "Sensirion"}
device_type = complete_local_name
Expand Down
2 changes: 1 addition & 1 deletion custom_components/ble_monitor/ble_parser/sensorpush.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def decode_values(mfg_data: bytes, device_type_id: int) -> dict:
return values


def parse_sensorpush(self, data: bytes, mac: str):
def parse_sensorpush(self, data: bytes, mac: bytes):
"""Sensorpush parser"""
result = {"firmware": "SensorPush"}
device_type = None
Expand Down
2 changes: 1 addition & 1 deletion custom_components/ble_monitor/ble_parser/senssun.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def read_stable(ctr1):
"""Parse Stable"""
return int((ctr1 & 0xA0) == 0xA0)

def parse_senssun(self, data: bytes, mac: str):
def parse_senssun(self, data: bytes, mac: bytes):
"""Parser for Senssun Scales."""
xvalue = data[13:19]

Expand Down
2 changes: 1 addition & 1 deletion custom_components/ble_monitor/ble_parser/smartdry.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
_LOGGER = logging.getLogger(__name__)


def parse_smartdry(self, data: bytes, mac: str):
def parse_smartdry(self, data: bytes, mac: bytes):
"""Parser for SmartDry cloth dryer"""
msg_length = len(data)
if msg_length == 16:
Expand Down
2 changes: 1 addition & 1 deletion custom_components/ble_monitor/ble_parser/switchbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
_LOGGER = logging.getLogger(__name__)


def parse_switchbot(self, data: bytes, mac: str):
def parse_switchbot(self, data: bytes, mac: bytes):
"""Switchbot parser"""
msg_length = len(data)
device_id = data[4]
Expand Down
2 changes: 1 addition & 1 deletion custom_components/ble_monitor/ble_parser/teltonika.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
_LOGGER = logging.getLogger(__name__)


def parse_teltonika(self, data: bytes, complete_local_name: str, mac: str):
def parse_teltonika(self, data: bytes, complete_local_name: str, mac: bytes):
"""Teltonika parser"""
result = {"firmware": "Teltonika"}
device_id = (data[3] << 8) | data[2]
Expand Down
2 changes: 1 addition & 1 deletion custom_components/ble_monitor/ble_parser/thermobeacon.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
_LOGGER = logging.getLogger(__name__)


def parse_thermobeacon(self, data: bytes, mac: str):
def parse_thermobeacon(self, data: bytes, mac: bytes):
"""Thermobeacon parser"""
msg_length = len(data)
device_id = data[2]
Expand Down
2 changes: 1 addition & 1 deletion custom_components/ble_monitor/ble_parser/thermopro.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
_LOGGER = logging.getLogger(__name__)


def parse_thermopro(self, data: bytes, device_type, mac: str):
def parse_thermopro(self, data: bytes, device_type, mac: bytes):
"""Thermopro parser"""
if device_type in ["TP357", "TP359"]:
firmware = "Thermopro"
Expand Down
2 changes: 1 addition & 1 deletion custom_components/ble_monitor/ble_parser/tilt.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
_LOGGER = logging.getLogger(__name__)


def parse_tilt(self, data: bytes, mac: str, ):
def parse_tilt(self, data: bytes, mac: bytes):
"""Tilt parser"""
if data[5] == 0x15 and len(data) == 27:
uuid = data[6:22]
Expand Down
2 changes: 1 addition & 1 deletion custom_components/ble_monitor/ble_parser/xiaogui.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
_LOGGER = logging.getLogger(__name__)


def parse_xiaogui(self, data: bytes, mac: str):
def parse_xiaogui(self, data: bytes, mac: bytes):
"""Xiaogui Scales parser"""
msg_length = len(data)

Expand Down
2 changes: 1 addition & 1 deletion custom_components/ble_monitor/ble_parser/xiaomi.py
Original file line number Diff line number Diff line change
Expand Up @@ -1293,7 +1293,7 @@ def obj5a16(xobj):
}


def parse_xiaomi(self, data: bytes, mac: str):
def parse_xiaomi(self, data: bytes, mac: bytes):
"""Parser for Xiaomi sensors"""
# check for adstruc length
i = 9 # till Frame Counter
Expand Down

0 comments on commit 5aaee29

Please sign in to comment.