From ebf21d1bd7cf25f81bfc0153059226f0444ccdbe Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Wed, 29 Jun 2022 11:41:56 +0200 Subject: [PATCH] Add BinarySensorEntity to pylint checks (#74131) --- pylint/plugins/hass_enforce_type_hints.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/pylint/plugins/hass_enforce_type_hints.py b/pylint/plugins/hass_enforce_type_hints.py index f3c7a01a10f..f08e6d932e7 100644 --- a/pylint/plugins/hass_enforce_type_hints.py +++ b/pylint/plugins/hass_enforce_type_hints.py @@ -678,6 +678,25 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = { ], ), ], + "binary_sensor": [ + ClassTypeHintMatch( + base_class="Entity", + matches=_ENTITY_MATCH, + ), + ClassTypeHintMatch( + base_class="BinarySensorEntity", + matches=[ + TypeHintMatch( + function_name="device_class", + return_type=["BinarySensorDeviceClass", "str", None], + ), + TypeHintMatch( + function_name="is_on", + return_type=["bool", None], + ), + ], + ), + ], "cover": [ ClassTypeHintMatch( base_class="Entity",