Add device trigger support to sensor entities (#27133)
* Add device trigger support to sensor entities * Fix typing * Fix tests, add test helper for comparing lists
This commit is contained in:
parent
e005f6f23a
commit
3e99743244
10 changed files with 689 additions and 11 deletions
|
@ -40,7 +40,9 @@ TRIGGER_SCHEMA = vol.All(
|
|||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
async def async_attach_trigger(hass, config, action, automation_info):
|
||||
async def async_attach_trigger(
|
||||
hass, config, action, automation_info, *, platform_type="numeric_state"
|
||||
):
|
||||
"""Listen for state changes based on configuration."""
|
||||
entity_id = config.get(CONF_ENTITY_ID)
|
||||
below = config.get(CONF_BELOW)
|
||||
|
@ -84,7 +86,7 @@ async def async_attach_trigger(hass, config, action, automation_info):
|
|||
action(
|
||||
{
|
||||
"trigger": {
|
||||
"platform": "numeric_state",
|
||||
"platform": platform_type,
|
||||
"entity_id": entity,
|
||||
"below": below,
|
||||
"above": above,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue