Add logbook platforms (#37078)
* Add logbook platforms * Fix logbook describe test
This commit is contained in:
1 parent
508afd3b90
commit
5cbf77221a
19 files changed
+215
-116
No files matched your search
@@ -188,19 +188,6 @@ async def async_setup(hass, config):
|
||||
DOMAIN, SERVICE_TOGGLE, toggle_service, schema=SCRIPT_TURN_ONOFF_SCHEMA
|
||||
)
|
||||
|
||||
@callback
|
||||
def async_describe_logbook_event(event):
|
||||
"""Describe the logbook event."""
|
||||
return {
|
||||
"name": event.data.get(ATTR_NAME),
|
||||
"message": "started",
|
||||
"entity_id": event.data.get(ATTR_ENTITY_ID),
|
||||
}
|
||||
|
||||
hass.components.logbook.async_describe_event(
|
||||
DOMAIN, EVENT_SCRIPT_STARTED, async_describe_logbook_event
|
||||
)
|
||||
|
||||
return True
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
"""Describe logbook events."""
|
||||
from homeassistant.const import ATTR_ENTITY_ID, ATTR_NAME
|
||||
from homeassistant.core import callback
|
||||
|
||||
from . import DOMAIN, EVENT_SCRIPT_STARTED
|
||||
|
||||
|
||||
@callback
|
||||
def async_describe_events(hass, async_describe_event):
|
||||
"""Describe logbook events."""
|
||||
|
||||
@callback
|
||||
def async_describe_logbook_event(event):
|
||||
"""Describe the logbook event."""
|
||||
return {
|
||||
"name": event.data.get(ATTR_NAME),
|
||||
"message": "started",
|
||||
"entity_id": event.data.get(ATTR_ENTITY_ID),
|
||||
}
|
||||
|
||||
async_describe_event(DOMAIN, EVENT_SCRIPT_STARTED, async_describe_logbook_event)
|
||||
@@ -2,7 +2,8 @@
|
||||
"domain": "script",
|
||||
"name": "Scripts",
|
||||
"documentation": "https://www.home-assistant.io/integrations/script",
|
||||
"after_dependencies": ["logbook"],
|
||||
"codeowners": ["@home-assistant/core"],
|
||||
"codeowners": [
|
||||
"@home-assistant/core"
|
||||
],
|
||||
"quality_scale": "internal"
|
||||
}
|
||||
Reference in new issue
Block a user