mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Do not select all entities when omitting entity ID in service call (#29178)
* Do not select all entities when omitting entity ID * Address comments Matthew * Require either area_id or entity_id * Fix tests * Fix test
This commit is contained in:
@@ -13,11 +13,12 @@ from homeassistant.const import (
|
||||
SERVICE_ALARM_ARM_AWAY,
|
||||
SERVICE_ALARM_ARM_NIGHT,
|
||||
SERVICE_ALARM_ARM_CUSTOM_BYPASS,
|
||||
ENTITY_MATCH_ALL,
|
||||
)
|
||||
from homeassistant.loader import bind_hass
|
||||
|
||||
|
||||
async def async_alarm_disarm(hass, code=None, entity_id=None):
|
||||
async def async_alarm_disarm(hass, code=None, entity_id=ENTITY_MATCH_ALL):
|
||||
"""Send the alarm the command for disarm."""
|
||||
data = {}
|
||||
if code:
|
||||
@@ -29,7 +30,7 @@ async def async_alarm_disarm(hass, code=None, entity_id=None):
|
||||
|
||||
|
||||
@bind_hass
|
||||
def alarm_disarm(hass, code=None, entity_id=None):
|
||||
def alarm_disarm(hass, code=None, entity_id=ENTITY_MATCH_ALL):
|
||||
"""Send the alarm the command for disarm."""
|
||||
data = {}
|
||||
if code:
|
||||
@@ -40,7 +41,7 @@ def alarm_disarm(hass, code=None, entity_id=None):
|
||||
hass.services.call(DOMAIN, SERVICE_ALARM_DISARM, data)
|
||||
|
||||
|
||||
async def async_alarm_arm_home(hass, code=None, entity_id=None):
|
||||
async def async_alarm_arm_home(hass, code=None, entity_id=ENTITY_MATCH_ALL):
|
||||
"""Send the alarm the command for disarm."""
|
||||
data = {}
|
||||
if code:
|
||||
@@ -52,7 +53,7 @@ async def async_alarm_arm_home(hass, code=None, entity_id=None):
|
||||
|
||||
|
||||
@bind_hass
|
||||
def alarm_arm_home(hass, code=None, entity_id=None):
|
||||
def alarm_arm_home(hass, code=None, entity_id=ENTITY_MATCH_ALL):
|
||||
"""Send the alarm the command for arm home."""
|
||||
data = {}
|
||||
if code:
|
||||
@@ -63,7 +64,7 @@ def alarm_arm_home(hass, code=None, entity_id=None):
|
||||
hass.services.call(DOMAIN, SERVICE_ALARM_ARM_HOME, data)
|
||||
|
||||
|
||||
async def async_alarm_arm_away(hass, code=None, entity_id=None):
|
||||
async def async_alarm_arm_away(hass, code=None, entity_id=ENTITY_MATCH_ALL):
|
||||
"""Send the alarm the command for disarm."""
|
||||
data = {}
|
||||
if code:
|
||||
@@ -75,7 +76,7 @@ async def async_alarm_arm_away(hass, code=None, entity_id=None):
|
||||
|
||||
|
||||
@bind_hass
|
||||
def alarm_arm_away(hass, code=None, entity_id=None):
|
||||
def alarm_arm_away(hass, code=None, entity_id=ENTITY_MATCH_ALL):
|
||||
"""Send the alarm the command for arm away."""
|
||||
data = {}
|
||||
if code:
|
||||
@@ -86,7 +87,7 @@ def alarm_arm_away(hass, code=None, entity_id=None):
|
||||
hass.services.call(DOMAIN, SERVICE_ALARM_ARM_AWAY, data)
|
||||
|
||||
|
||||
async def async_alarm_arm_night(hass, code=None, entity_id=None):
|
||||
async def async_alarm_arm_night(hass, code=None, entity_id=ENTITY_MATCH_ALL):
|
||||
"""Send the alarm the command for disarm."""
|
||||
data = {}
|
||||
if code:
|
||||
@@ -98,7 +99,7 @@ async def async_alarm_arm_night(hass, code=None, entity_id=None):
|
||||
|
||||
|
||||
@bind_hass
|
||||
def alarm_arm_night(hass, code=None, entity_id=None):
|
||||
def alarm_arm_night(hass, code=None, entity_id=ENTITY_MATCH_ALL):
|
||||
"""Send the alarm the command for arm night."""
|
||||
data = {}
|
||||
if code:
|
||||
@@ -109,7 +110,7 @@ def alarm_arm_night(hass, code=None, entity_id=None):
|
||||
hass.services.call(DOMAIN, SERVICE_ALARM_ARM_NIGHT, data)
|
||||
|
||||
|
||||
async def async_alarm_trigger(hass, code=None, entity_id=None):
|
||||
async def async_alarm_trigger(hass, code=None, entity_id=ENTITY_MATCH_ALL):
|
||||
"""Send the alarm the command for disarm."""
|
||||
data = {}
|
||||
if code:
|
||||
@@ -121,7 +122,7 @@ async def async_alarm_trigger(hass, code=None, entity_id=None):
|
||||
|
||||
|
||||
@bind_hass
|
||||
def alarm_trigger(hass, code=None, entity_id=None):
|
||||
def alarm_trigger(hass, code=None, entity_id=ENTITY_MATCH_ALL):
|
||||
"""Send the alarm the command for trigger."""
|
||||
data = {}
|
||||
if code:
|
||||
@@ -132,7 +133,7 @@ def alarm_trigger(hass, code=None, entity_id=None):
|
||||
hass.services.call(DOMAIN, SERVICE_ALARM_TRIGGER, data)
|
||||
|
||||
|
||||
async def async_alarm_arm_custom_bypass(hass, code=None, entity_id=None):
|
||||
async def async_alarm_arm_custom_bypass(hass, code=None, entity_id=ENTITY_MATCH_ALL):
|
||||
"""Send the alarm the command for disarm."""
|
||||
data = {}
|
||||
if code:
|
||||
@@ -146,7 +147,7 @@ async def async_alarm_arm_custom_bypass(hass, code=None, entity_id=None):
|
||||
|
||||
|
||||
@bind_hass
|
||||
def alarm_arm_custom_bypass(hass, code=None, entity_id=None):
|
||||
def alarm_arm_custom_bypass(hass, code=None, entity_id=ENTITY_MATCH_ALL):
|
||||
"""Send the alarm the command for arm custom bypass."""
|
||||
data = {}
|
||||
if code:
|
||||
|
||||
Reference in New Issue
Block a user