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

Add device action to mobile app to notify (#43814)

This commit is contained in:
Paulus Schoutsen
2020-12-01 18:14:01 +01:00
committed by GitHub
parent 52217f1f60
commit 7d23ff6511
17 changed files with 263 additions and 32 deletions

View File

@@ -1,4 +1,4 @@
"""Provides device automations for NEW_NAME."""
"""Provides device actions for NEW_NAME."""
from typing import List, Optional
import voluptuous as vol
@@ -72,8 +72,6 @@ async def async_call_action_from_config(
hass: HomeAssistant, config: dict, variables: dict, context: Optional[Context]
) -> None:
"""Execute a device action."""
config = ACTION_SCHEMA(config)
service_data = {ATTR_ENTITY_ID: config[CONF_ENTITY_ID]}
if config[CONF_TYPE] == "turn_on":

View File

@@ -1,8 +1,8 @@
"""The tests for NEW_NAME device actions."""
import pytest
from homeassistant.components import automation
from homeassistant.components.NEW_DOMAIN import DOMAIN
import homeassistant.components.automation as automation
from homeassistant.helpers import device_registry
from homeassistant.setup import async_setup_component

View File

@@ -1,4 +1,4 @@
"""Provide the device automations for NEW_NAME."""
"""Provide the device conditions for NEW_NAME."""
from typing import Dict, List
import voluptuous as vol

View File

@@ -1,8 +1,8 @@
"""The tests for NEW_NAME device conditions."""
import pytest
from homeassistant.components import automation
from homeassistant.components.NEW_DOMAIN import DOMAIN
import homeassistant.components.automation as automation
from homeassistant.const import STATE_OFF, STATE_ON
from homeassistant.helpers import device_registry
from homeassistant.setup import async_setup_component

View File

@@ -1,4 +1,4 @@
"""Provides device automations for NEW_NAME."""
"""Provides device triggers for NEW_NAME."""
from typing import List
import voluptuous as vol
@@ -80,11 +80,8 @@ async def async_attach_trigger(
automation_info: dict,
) -> CALLBACK_TYPE:
"""Attach a trigger."""
config = TRIGGER_SCHEMA(config)
# TODO Implement your own logic to attach triggers.
# Generally we suggest to re-use the existing state or event
# triggers from the automation integration.
# Use the existing state or event triggers from the automation integration.
if config[CONF_TYPE] == "turned_on":
from_state = STATE_OFF

View File

@@ -1,8 +1,8 @@
"""The tests for NEW_NAME device triggers."""
import pytest
from homeassistant.components import automation
from homeassistant.components.NEW_DOMAIN import DOMAIN
import homeassistant.components.automation as automation
from homeassistant.const import STATE_OFF, STATE_ON
from homeassistant.helpers import device_registry
from homeassistant.setup import async_setup_component