mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Mark state final in BinarySensorEntity (#51234)
This commit is contained in:
parent
931ff70ebe
commit
25c0739e22
@ -3,6 +3,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
|
from typing import final
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
@ -150,12 +151,14 @@ class BinarySensorEntity(Entity):
|
|||||||
"""Represent a binary sensor."""
|
"""Represent a binary sensor."""
|
||||||
|
|
||||||
_attr_is_on: bool | None = None
|
_attr_is_on: bool | None = None
|
||||||
|
_attr_state: None = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_on(self) -> bool | None:
|
def is_on(self) -> bool | None:
|
||||||
"""Return true if the binary sensor is on."""
|
"""Return true if the binary sensor is on."""
|
||||||
return self._attr_is_on
|
return self._attr_is_on
|
||||||
|
|
||||||
|
@final
|
||||||
@property
|
@property
|
||||||
def state(self) -> StateType:
|
def state(self) -> StateType:
|
||||||
"""Return the state of the binary sensor."""
|
"""Return the state of the binary sensor."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user