@@ -353,17 +353,13 @@ def _update_from_device(self) -> None:
353353 device_class = BinarySensorDeviceClass .PROBLEM ,
354354 entity_category = EntityCategory .DIAGNOSTIC ,
355355 # DeviceFault or SupplyFault bit enabled
356- device_to_ha = {
357- clusters .PumpConfigurationAndControl .Bitmaps .PumpStatusBitmap .kDeviceFault : True ,
358- clusters .PumpConfigurationAndControl .Bitmaps .PumpStatusBitmap .kSupplyFault : True ,
359- clusters .PumpConfigurationAndControl .Bitmaps .PumpStatusBitmap .kSpeedLow : False ,
360- clusters .PumpConfigurationAndControl .Bitmaps .PumpStatusBitmap .kSpeedHigh : False ,
361- clusters .PumpConfigurationAndControl .Bitmaps .PumpStatusBitmap .kLocalOverride : False ,
362- clusters .PumpConfigurationAndControl .Bitmaps .PumpStatusBitmap .kRunning : False ,
363- clusters .PumpConfigurationAndControl .Bitmaps .PumpStatusBitmap .kRemotePressure : False ,
364- clusters .PumpConfigurationAndControl .Bitmaps .PumpStatusBitmap .kRemoteFlow : False ,
365- clusters .PumpConfigurationAndControl .Bitmaps .PumpStatusBitmap .kRemoteTemperature : False ,
366- }.get ,
356+ device_to_ha = lambda x : bool (
357+ x
358+ & (
359+ clusters .PumpConfigurationAndControl .Bitmaps .PumpStatusBitmap .kDeviceFault
360+ | clusters .PumpConfigurationAndControl .Bitmaps .PumpStatusBitmap .kSupplyFault
361+ )
362+ ),
367363 ),
368364 entity_class = MatterBinarySensor ,
369365 required_attributes = (
@@ -377,9 +373,9 @@ def _update_from_device(self) -> None:
377373 key = "PumpStatusRunning" ,
378374 translation_key = "pump_running" ,
379375 device_class = BinarySensorDeviceClass .RUNNING ,
380- device_to_ha = lambda x : (
376+ device_to_ha = lambda x : bool (
381377 x
382- == clusters .PumpConfigurationAndControl .Bitmaps .PumpStatusBitmap .kRunning
378+ & clusters .PumpConfigurationAndControl .Bitmaps .PumpStatusBitmap .kRunning
383379 ),
384380 ),
385381 entity_class = MatterBinarySensor ,
@@ -395,8 +391,8 @@ def _update_from_device(self) -> None:
395391 translation_key = "dishwasher_alarm_inflow" ,
396392 device_class = BinarySensorDeviceClass .PROBLEM ,
397393 entity_category = EntityCategory .DIAGNOSTIC ,
398- device_to_ha = lambda x : (
399- x == clusters .DishwasherAlarm .Bitmaps .AlarmBitmap .kInflowError
394+ device_to_ha = lambda x : bool (
395+ x & clusters .DishwasherAlarm .Bitmaps .AlarmBitmap .kInflowError
400396 ),
401397 ),
402398 entity_class = MatterBinarySensor ,
@@ -410,8 +406,8 @@ def _update_from_device(self) -> None:
410406 translation_key = "alarm_door" ,
411407 device_class = BinarySensorDeviceClass .PROBLEM ,
412408 entity_category = EntityCategory .DIAGNOSTIC ,
413- device_to_ha = lambda x : (
414- x == clusters .DishwasherAlarm .Bitmaps .AlarmBitmap .kDoorError
409+ device_to_ha = lambda x : bool (
410+ x & clusters .DishwasherAlarm .Bitmaps .AlarmBitmap .kDoorError
415411 ),
416412 ),
417413 entity_class = MatterBinarySensor ,
@@ -481,8 +477,8 @@ def _update_from_device(self) -> None:
481477 translation_key = "alarm_door" ,
482478 device_class = BinarySensorDeviceClass .PROBLEM ,
483479 entity_category = EntityCategory .DIAGNOSTIC ,
484- device_to_ha = lambda x : (
485- x == clusters .RefrigeratorAlarm .Bitmaps .AlarmBitmap .kDoorOpen
480+ device_to_ha = lambda x : bool (
481+ x & clusters .RefrigeratorAlarm .Bitmaps .AlarmBitmap .kDoorOpen
486482 ),
487483 ),
488484 entity_class = MatterBinarySensor ,
0 commit comments