From 5846d19464c94d289e06f48fa0f0826eaa034eec Mon Sep 17 00:00:00 2001 From: Andrew Jackson Date: Sat, 6 Jan 2024 14:14:38 +0000 Subject: [PATCH] Attribs (#390) * Add attributes to battery_type sensor * Got some debugging working * Declare regex as raw string --- custom_components/battery_notes/sensor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/battery_notes/sensor.py b/custom_components/battery_notes/sensor.py index 63a564180..cd3515342 100644 --- a/custom_components/battery_notes/sensor.py +++ b/custom_components/battery_notes/sensor.py @@ -251,7 +251,7 @@ def extra_state_attributes(self) -> dict[str, str] | None: """Return the state attributes of the battery type.""" matches: re.Match = re.search( - "^(\d+)(?=x)(?:x\s)(\w+$)|([\s\S]+)", self._battery_type + r"^(\d+)(?=x)(?:x\s)(\w+$)|([\s\S]+)", self._battery_type ) if matches: _qty = matches.group(1) if matches.group(1) is not None else "1"