mirror of
https://github.com/home-assistant/core.git
synced 2026-05-03 19:41:15 +02:00
Apply suggestions from code review
This commit is contained in:
@@ -4,13 +4,9 @@ from __future__ import annotations
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.trigger import Trigger
|
||||
from homeassistant.util.decorator import Registry
|
||||
|
||||
from .triggers import event, value_updated
|
||||
|
||||
TRIGGERS = {
|
||||
event.PLATFORM_TYPE: event.EventTrigger,
|
||||
value_updated.PLATFORM_TYPE: value_updated.ValueUpdatedTrigger,
|
||||
}
|
||||
TRIGGERS: Registry[str, type[Trigger]] = Registry()
|
||||
|
||||
|
||||
async def async_get_triggers(hass: HomeAssistant) -> dict[str, type[Trigger]]:
|
||||
|
||||
@@ -34,6 +34,7 @@ from ..helpers import (
|
||||
get_device_id,
|
||||
get_home_and_node_id_from_device_entry,
|
||||
)
|
||||
from ..trigger import TRIGGERS
|
||||
from .trigger_helpers import async_bypass_dynamic_config_validation
|
||||
|
||||
# Platform type should be <DOMAIN>.<SUBMODULE_NAME>
|
||||
@@ -253,6 +254,7 @@ async def async_attach_trigger(
|
||||
return async_remove
|
||||
|
||||
|
||||
@TRIGGERS.register(PLATFORM_TYPE)
|
||||
class EventTrigger(Trigger):
|
||||
"""Z-Wave JS event trigger."""
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ from ..const import (
|
||||
EVENT_VALUE_UPDATED,
|
||||
)
|
||||
from ..helpers import async_get_nodes_from_targets, get_device_id
|
||||
from ..trigger import TRIGGERS
|
||||
from .trigger_helpers import async_bypass_dynamic_config_validation
|
||||
|
||||
# Platform type should be <DOMAIN>.<SUBMODULE_NAME>
|
||||
@@ -204,6 +205,7 @@ async def async_attach_trigger(
|
||||
return async_remove
|
||||
|
||||
|
||||
@TRIGGERS.register(PLATFORM_TYPE)
|
||||
class ValueUpdatedTrigger(Trigger):
|
||||
"""Z-Wave JS value updated trigger."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user