Mark state final in BinarySensorEntity (#51234)

This commit is contained in:
Franck Nijhof 2021-06-02 14:32:25 +02:00 committed by GitHub
parent 931ff70ebe
commit 25c0739e22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,7 @@ from __future__ import annotations
from datetime import timedelta
import logging
from typing import final
import voluptuous as vol
@ -150,12 +151,14 @@ class BinarySensorEntity(Entity):
"""Represent a binary sensor."""
_attr_is_on: bool | None = None
_attr_state: None = None
@property
def is_on(self) -> bool | None:
"""Return true if the binary sensor is on."""
return self._attr_is_on
@final
@property
def state(self) -> StateType:
"""Return the state of the binary sensor."""