1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Only generate device trigger for sensor with unit (#27152)

This commit is contained in:
Erik Montnemery
2019-10-03 22:30:59 +02:00
committed by Paulus Schoutsen
parent cda7692f24
commit 89ebc17fb1
3 changed files with 33 additions and 4 deletions

View File

@@ -2,7 +2,7 @@
from datetime import timedelta
import pytest
from homeassistant.components.sensor import DOMAIN, DEVICE_CLASSES
from homeassistant.components.sensor import DOMAIN
from homeassistant.components.sensor.device_trigger import ENTITY_TRIGGERS
from homeassistant.const import STATE_UNKNOWN, CONF_PLATFORM
from homeassistant.setup import async_setup_component
@@ -19,6 +19,7 @@ from tests.common import (
async_get_device_automations,
async_get_device_automation_capabilities,
)
from tests.testing_config.custom_components.test.sensor import DEVICE_CLASSES
@pytest.fixture
@@ -70,6 +71,7 @@ async def test_get_triggers(hass, device_reg, entity_reg):
}
for device_class in DEVICE_CLASSES
for trigger in ENTITY_TRIGGERS[device_class]
if device_class != "none"
]
triggers = await async_get_device_automations(hass, "trigger", device_entry.id)
assert triggers == expected_triggers