Remove service helper (4) (#16892)
* Update media_player * Update lock * Update notify * Update remote * Update scene * Update vacuum * Remove timer helpers * Removed unused legacy helpers
This commit is contained in:
parent
d0ddc28f96
commit
dd45e99302
23 changed files with 499 additions and 520 deletions
24
tests/components/notify/common.py
Normal file
24
tests/components/notify/common.py
Normal file
|
@ -0,0 +1,24 @@
|
|||
"""Collection of helper methods.
|
||||
|
||||
All containing methods are legacy helpers that should not be used by new
|
||||
components. Instead call the service directly.
|
||||
"""
|
||||
from homeassistant.components.notify import (
|
||||
ATTR_DATA, ATTR_MESSAGE, ATTR_TITLE, DOMAIN, SERVICE_NOTIFY)
|
||||
from homeassistant.loader import bind_hass
|
||||
|
||||
|
||||
@bind_hass
|
||||
def send_message(hass, message, title=None, data=None):
|
||||
"""Send a notification message."""
|
||||
info = {
|
||||
ATTR_MESSAGE: message
|
||||
}
|
||||
|
||||
if title is not None:
|
||||
info[ATTR_TITLE] = title
|
||||
|
||||
if data is not None:
|
||||
info[ATTR_DATA] = data
|
||||
|
||||
hass.services.call(DOMAIN, SERVICE_NOTIFY, info)
|
Loading…
Add table
Add a link
Reference in a new issue