use SwitchEntity in example (#887)

instead of deprecated SwitchDevice
This commit is contained in:
Matthias Alphart 2021-04-14 17:33:44 +02:00 committed by GitHub
parent 5537cef36c
commit 880e00d8f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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