mirror of
https://github.com/home-assistant/developers.home-assistant.git
synced 2025-07-08 18:06:29 +00:00
parent
5537cef36c
commit
880e00d8f1
@ -12,16 +12,16 @@ For a generic introduction of entities, see [entities architecture](../architect
|
||||
Below is an example switch entity that keeps track of their state in memory.
|
||||
|
||||
```python
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
|
||||
|
||||
class MySwitch(SwitchDevice):
|
||||
class MySwitch(SwitchEntity):
|
||||
def __init__(self):
|
||||
self._is_on = False
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""Name of the device."""
|
||||
"""Name of the entity."""
|
||||
return "My Switch"
|
||||
|
||||
@property
|
||||
|
Loading…
x
Reference in New Issue
Block a user