From 6ad86c6c9a1c4c7bdd0586f5d848a8d59ae2e3e0 Mon Sep 17 00:00:00 2001 From: James Nimmo Date: Sun, 26 Apr 2026 09:36:19 +1200 Subject: [PATCH] fix: guard against None mode_map in get_mode_list When a device doesn't include config_mode_map or config_operating_mode in its API response, mode_map is None and the bitwise & operator raises TypeError: unsupported operand type(s) for &: 'NoneType' and 'int'. Fixes https://github.com/home-assistant/core/issues/167474 Co-Authored-By: Claude Sonnet 4.6 --- pyintesishome/intesisbase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyintesishome/intesisbase.py b/pyintesishome/intesisbase.py index c8955ca..90cbf81 100644 --- a/pyintesishome/intesisbase.py +++ b/pyintesishome/intesisbase.py @@ -311,7 +311,7 @@ def get_mode_list(self, device_id) -> list: # Generate the mode list from the map for mode_bit in mode_bits: - if mode_map & mode_bit: + if mode_map is not None and mode_map & mode_bit: mode_list.append(mode_bits.get(mode_bit)) return mode_list