Files
homeassistant_config/config/custom_components/pyscript/entity.py
2024-08-09 06:45:02 +02:00

20 lines
561 B
Python

"""Entity Classes."""
from homeassistant.const import STATE_UNKNOWN
from homeassistant.helpers.restore_state import RestoreEntity
from homeassistant.helpers.typing import StateType
class PyscriptEntity(RestoreEntity):
"""Generic Pyscript Entity."""
_attr_extra_state_attributes: dict
_attr_state: StateType = STATE_UNKNOWN
def set_state(self, state):
"""Set the state."""
self._attr_state = state
def set_attributes(self, attributes):
"""Set Attributes."""
self._attr_extra_state_attributes = attributes