Skip to content

Commit bccaedb

Browse files
kingpanther13claude
andcommitted
fix: add str() cast in fetch_entity_category for mypy
categories.get(scope) returns Any from untyped dict; cast to str to match declared str | None return type. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 34e89ee commit bccaedb

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/ha_mcp/tools/util_helpers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,8 @@ async def fetch_entity_category(
388388
)
389389
if result.get("success"):
390390
categories = result.get("result", {}).get("categories", {})
391-
return categories.get(scope)
391+
cat_id = categories.get(scope)
392+
return str(cat_id) if cat_id is not None else None
392393
except Exception as e:
393394
logger.debug(f"Failed to fetch category for {entity_id}: {e}")
394395
return None

0 commit comments

Comments
 (0)