Changed wording of bond state belief feature from belief to tracked state (#56147)
Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
parent
990d474d02
commit
41b25a765c
8 changed files with 55 additions and 49 deletions
|
@ -11,8 +11,8 @@ HUB = "hub"
|
|||
BPUP_SUBS = "bpup_subs"
|
||||
BPUP_STOP = "bpup_stop"
|
||||
|
||||
SERVICE_SET_FAN_SPEED_BELIEF = "set_fan_speed_belief"
|
||||
SERVICE_SET_POWER_BELIEF = "set_switch_power_belief"
|
||||
SERVICE_SET_LIGHT_POWER_BELIEF = "set_light_power_belief"
|
||||
SERVICE_SET_LIGHT_BRIGHTNESS_BELIEF = "set_light_brightness_belief"
|
||||
SERVICE_SET_FAN_SPEED_TRACKED_STATE = "set_fan_speed_tracked_state"
|
||||
SERVICE_SET_POWER_TRACKED_STATE = "set_switch_power_tracked_state"
|
||||
SERVICE_SET_LIGHT_POWER_TRACKED_STATE = "set_light_power_tracked_state"
|
||||
SERVICE_SET_LIGHT_BRIGHTNESS_TRACKED_STATE = "set_light_brightness_tracked_state"
|
||||
ATTR_POWER_STATE = "power_state"
|
||||
|
|
|
@ -29,7 +29,7 @@ from homeassistant.util.percentage import (
|
|||
ranged_value_to_percentage,
|
||||
)
|
||||
|
||||
from .const import BPUP_SUBS, DOMAIN, HUB, SERVICE_SET_FAN_SPEED_BELIEF
|
||||
from .const import BPUP_SUBS, DOMAIN, HUB, SERVICE_SET_FAN_SPEED_TRACKED_STATE
|
||||
from .entity import BondEntity
|
||||
from .utils import BondDevice, BondHub
|
||||
|
||||
|
@ -54,7 +54,7 @@ async def async_setup_entry(
|
|||
]
|
||||
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_SET_FAN_SPEED_BELIEF,
|
||||
SERVICE_SET_FAN_SPEED_TRACKED_STATE,
|
||||
{vol.Required(ATTR_SPEED): vol.All(vol.Number(scale=0), vol.Range(0, 100))},
|
||||
"async_set_speed_belief",
|
||||
)
|
||||
|
|
|
@ -26,8 +26,8 @@ from .const import (
|
|||
BPUP_SUBS,
|
||||
DOMAIN,
|
||||
HUB,
|
||||
SERVICE_SET_LIGHT_BRIGHTNESS_BELIEF,
|
||||
SERVICE_SET_LIGHT_POWER_BELIEF,
|
||||
SERVICE_SET_LIGHT_BRIGHTNESS_TRACKED_STATE,
|
||||
SERVICE_SET_LIGHT_POWER_TRACKED_STATE,
|
||||
)
|
||||
from .entity import BondEntity
|
||||
from .utils import BondDevice
|
||||
|
@ -103,7 +103,7 @@ async def async_setup_entry(
|
|||
]
|
||||
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_SET_LIGHT_BRIGHTNESS_BELIEF,
|
||||
SERVICE_SET_LIGHT_BRIGHTNESS_TRACKED_STATE,
|
||||
{
|
||||
vol.Required(ATTR_BRIGHTNESS): vol.All(
|
||||
vol.Number(scale=0), vol.Range(0, 255)
|
||||
|
@ -113,7 +113,7 @@ async def async_setup_entry(
|
|||
)
|
||||
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_SET_LIGHT_POWER_BELIEF,
|
||||
SERVICE_SET_LIGHT_POWER_TRACKED_STATE,
|
||||
{vol.Required(ATTR_POWER_STATE): vol.All(cv.boolean)},
|
||||
"async_set_power_belief",
|
||||
)
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
# Describes the format for available bond services
|
||||
|
||||
set_fan_speed_belief:
|
||||
name: Set believed fan speed
|
||||
description: Sets the believed fan speed for a bond fan
|
||||
set_fan_speed_tracked_state:
|
||||
name: Set fan speed tracked state
|
||||
description: Sets the tracked fan speed for a bond fan
|
||||
fields:
|
||||
entity_id:
|
||||
description: Name(s) of entities to set the believed fan speed.
|
||||
description: Name(s) of entities to set the tracked fan speed.
|
||||
example: "fan.living_room_fan"
|
||||
name: Entity
|
||||
required: true
|
||||
|
@ -25,12 +25,12 @@ set_fan_speed_belief:
|
|||
step: 1
|
||||
mode: slider
|
||||
|
||||
set_switch_power_belief:
|
||||
name: Set believed switch power state
|
||||
description: Sets the believed power state of a bond switch
|
||||
set_switch_power_tracked_state:
|
||||
name: Set switch power tracked state
|
||||
description: Sets the tracked power state of a bond switch
|
||||
fields:
|
||||
entity_id:
|
||||
description: Name(s) of entities to set the believed power state of.
|
||||
description: Name(s) of entities to set the tracked power state of.
|
||||
example: "switch.whatever"
|
||||
name: Entity
|
||||
required: true
|
||||
|
@ -46,12 +46,12 @@ set_switch_power_belief:
|
|||
selector:
|
||||
boolean:
|
||||
|
||||
set_light_power_belief:
|
||||
name: Set believed light power state
|
||||
description: Sets the believed light power state of a bond light
|
||||
set_light_power_tracked_state:
|
||||
name: Set light power tracked state
|
||||
description: Sets the tracked power state of a bond light
|
||||
fields:
|
||||
entity_id:
|
||||
description: Name(s) of entities to set the believed power state of.
|
||||
description: Name(s) of entities to set the tracked power state of.
|
||||
example: "light.living_room_lights"
|
||||
name: Entity
|
||||
required: true
|
||||
|
@ -67,12 +67,12 @@ set_light_power_belief:
|
|||
selector:
|
||||
boolean:
|
||||
|
||||
set_light_brightness_belief:
|
||||
name: Set believed light brightness state
|
||||
description: Sets the believed light brightness state of a bond light
|
||||
set_light_brightness_tracked_state:
|
||||
name: Set light brightness tracked state
|
||||
description: Sets the tracked brightness state of a bond light
|
||||
fields:
|
||||
entity_id:
|
||||
description: Name(s) of entities to set the believed power state of.
|
||||
description: Name(s) of entities to set the tracked brightness state of.
|
||||
example: "light.living_room_lights"
|
||||
name: Entity
|
||||
required: true
|
||||
|
|
|
@ -15,7 +15,13 @@ from homeassistant.helpers import config_validation as cv, entity_platform
|
|||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
||||
from .const import ATTR_POWER_STATE, BPUP_SUBS, DOMAIN, HUB, SERVICE_SET_POWER_BELIEF
|
||||
from .const import (
|
||||
ATTR_POWER_STATE,
|
||||
BPUP_SUBS,
|
||||
DOMAIN,
|
||||
HUB,
|
||||
SERVICE_SET_POWER_TRACKED_STATE,
|
||||
)
|
||||
from .entity import BondEntity
|
||||
from .utils import BondHub
|
||||
|
||||
|
@ -38,7 +44,7 @@ async def async_setup_entry(
|
|||
]
|
||||
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_SET_POWER_BELIEF,
|
||||
SERVICE_SET_POWER_TRACKED_STATE,
|
||||
{vol.Required(ATTR_POWER_STATE): cv.boolean},
|
||||
"async_set_power_belief",
|
||||
)
|
||||
|
|
|
@ -10,7 +10,7 @@ from homeassistant import core
|
|||
from homeassistant.components import fan
|
||||
from homeassistant.components.bond.const import (
|
||||
DOMAIN as BOND_DOMAIN,
|
||||
SERVICE_SET_FAN_SPEED_BELIEF,
|
||||
SERVICE_SET_FAN_SPEED_TRACKED_STATE,
|
||||
)
|
||||
from homeassistant.components.fan import (
|
||||
ATTR_DIRECTION,
|
||||
|
@ -270,7 +270,7 @@ async def test_set_speed_belief_speed_zero(hass: core.HomeAssistant):
|
|||
with patch_bond_action() as mock_action, patch_bond_device_state():
|
||||
await hass.services.async_call(
|
||||
BOND_DOMAIN,
|
||||
SERVICE_SET_FAN_SPEED_BELIEF,
|
||||
SERVICE_SET_FAN_SPEED_TRACKED_STATE,
|
||||
{ATTR_ENTITY_ID: "fan.name_1", ATTR_SPEED: 0},
|
||||
blocking=True,
|
||||
)
|
||||
|
@ -292,7 +292,7 @@ async def test_set_speed_belief_speed_api_error(hass: core.HomeAssistant):
|
|||
), patch_bond_action_returns_clientresponseerror(), patch_bond_device_state():
|
||||
await hass.services.async_call(
|
||||
BOND_DOMAIN,
|
||||
SERVICE_SET_FAN_SPEED_BELIEF,
|
||||
SERVICE_SET_FAN_SPEED_TRACKED_STATE,
|
||||
{ATTR_ENTITY_ID: "fan.name_1", ATTR_SPEED: 100},
|
||||
blocking=True,
|
||||
)
|
||||
|
@ -308,7 +308,7 @@ async def test_set_speed_belief_speed_100(hass: core.HomeAssistant):
|
|||
with patch_bond_action() as mock_action, patch_bond_device_state():
|
||||
await hass.services.async_call(
|
||||
BOND_DOMAIN,
|
||||
SERVICE_SET_FAN_SPEED_BELIEF,
|
||||
SERVICE_SET_FAN_SPEED_TRACKED_STATE,
|
||||
{ATTR_ENTITY_ID: "fan.name_1", ATTR_SPEED: 100},
|
||||
blocking=True,
|
||||
)
|
||||
|
|
|
@ -8,8 +8,8 @@ from homeassistant import core
|
|||
from homeassistant.components.bond.const import (
|
||||
ATTR_POWER_STATE,
|
||||
DOMAIN,
|
||||
SERVICE_SET_LIGHT_BRIGHTNESS_BELIEF,
|
||||
SERVICE_SET_LIGHT_POWER_BELIEF,
|
||||
SERVICE_SET_LIGHT_BRIGHTNESS_TRACKED_STATE,
|
||||
SERVICE_SET_LIGHT_POWER_TRACKED_STATE,
|
||||
)
|
||||
from homeassistant.components.bond.light import (
|
||||
SERVICE_START_DECREASING_BRIGHTNESS,
|
||||
|
@ -296,7 +296,7 @@ async def test_light_set_brightness_belief_full(hass: core.HomeAssistant):
|
|||
with patch_bond_action() as mock_bond_action, patch_bond_device_state():
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
SERVICE_SET_LIGHT_BRIGHTNESS_BELIEF,
|
||||
SERVICE_SET_LIGHT_BRIGHTNESS_TRACKED_STATE,
|
||||
{ATTR_ENTITY_ID: "light.name_1", ATTR_BRIGHTNESS: 255},
|
||||
blocking=True,
|
||||
)
|
||||
|
@ -321,7 +321,7 @@ async def test_light_set_brightness_belief_api_error(hass: core.HomeAssistant):
|
|||
), patch_bond_action_returns_clientresponseerror(), patch_bond_device_state():
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
SERVICE_SET_LIGHT_BRIGHTNESS_BELIEF,
|
||||
SERVICE_SET_LIGHT_BRIGHTNESS_TRACKED_STATE,
|
||||
{ATTR_ENTITY_ID: "light.name_1", ATTR_BRIGHTNESS: 255},
|
||||
blocking=True,
|
||||
)
|
||||
|
@ -340,7 +340,7 @@ async def test_fp_light_set_brightness_belief_full(hass: core.HomeAssistant):
|
|||
with patch_bond_action() as mock_bond_action, patch_bond_device_state():
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
SERVICE_SET_LIGHT_BRIGHTNESS_BELIEF,
|
||||
SERVICE_SET_LIGHT_BRIGHTNESS_TRACKED_STATE,
|
||||
{ATTR_ENTITY_ID: "light.name_1", ATTR_BRIGHTNESS: 255},
|
||||
blocking=True,
|
||||
)
|
||||
|
@ -365,7 +365,7 @@ async def test_fp_light_set_brightness_belief_api_error(hass: core.HomeAssistant
|
|||
), patch_bond_action_returns_clientresponseerror(), patch_bond_device_state():
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
SERVICE_SET_LIGHT_BRIGHTNESS_BELIEF,
|
||||
SERVICE_SET_LIGHT_BRIGHTNESS_TRACKED_STATE,
|
||||
{ATTR_ENTITY_ID: "light.name_1", ATTR_BRIGHTNESS: 255},
|
||||
blocking=True,
|
||||
)
|
||||
|
@ -386,7 +386,7 @@ async def test_light_set_brightness_belief_brightnes_not_supported(
|
|||
with pytest.raises(HomeAssistantError), patch_bond_device_state():
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
SERVICE_SET_LIGHT_BRIGHTNESS_BELIEF,
|
||||
SERVICE_SET_LIGHT_BRIGHTNESS_TRACKED_STATE,
|
||||
{ATTR_ENTITY_ID: "light.name_1", ATTR_BRIGHTNESS: 255},
|
||||
blocking=True,
|
||||
)
|
||||
|
@ -405,7 +405,7 @@ async def test_light_set_brightness_belief_zero(hass: core.HomeAssistant):
|
|||
with patch_bond_action() as mock_bond_action, patch_bond_device_state():
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
SERVICE_SET_LIGHT_BRIGHTNESS_BELIEF,
|
||||
SERVICE_SET_LIGHT_BRIGHTNESS_TRACKED_STATE,
|
||||
{ATTR_ENTITY_ID: "light.name_1", ATTR_BRIGHTNESS: 0},
|
||||
blocking=True,
|
||||
)
|
||||
|
@ -428,7 +428,7 @@ async def test_fp_light_set_brightness_belief_zero(hass: core.HomeAssistant):
|
|||
with patch_bond_action() as mock_bond_action, patch_bond_device_state():
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
SERVICE_SET_LIGHT_BRIGHTNESS_BELIEF,
|
||||
SERVICE_SET_LIGHT_BRIGHTNESS_TRACKED_STATE,
|
||||
{ATTR_ENTITY_ID: "light.name_1", ATTR_BRIGHTNESS: 0},
|
||||
blocking=True,
|
||||
)
|
||||
|
@ -451,7 +451,7 @@ async def test_light_set_power_belief(hass: core.HomeAssistant):
|
|||
with patch_bond_action() as mock_bond_action, patch_bond_device_state():
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
SERVICE_SET_LIGHT_POWER_BELIEF,
|
||||
SERVICE_SET_LIGHT_POWER_TRACKED_STATE,
|
||||
{ATTR_ENTITY_ID: "light.name_1", ATTR_POWER_STATE: False},
|
||||
blocking=True,
|
||||
)
|
||||
|
@ -476,7 +476,7 @@ async def test_light_set_power_belief_api_error(hass: core.HomeAssistant):
|
|||
), patch_bond_action_returns_clientresponseerror(), patch_bond_device_state():
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
SERVICE_SET_LIGHT_POWER_BELIEF,
|
||||
SERVICE_SET_LIGHT_POWER_TRACKED_STATE,
|
||||
{ATTR_ENTITY_ID: "light.name_1", ATTR_POWER_STATE: False},
|
||||
blocking=True,
|
||||
)
|
||||
|
@ -495,7 +495,7 @@ async def test_fp_light_set_power_belief(hass: core.HomeAssistant):
|
|||
with patch_bond_action() as mock_bond_action, patch_bond_device_state():
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
SERVICE_SET_LIGHT_POWER_BELIEF,
|
||||
SERVICE_SET_LIGHT_POWER_TRACKED_STATE,
|
||||
{ATTR_ENTITY_ID: "light.name_1", ATTR_POWER_STATE: False},
|
||||
blocking=True,
|
||||
)
|
||||
|
@ -520,7 +520,7 @@ async def test_fp_light_set_power_belief_api_error(hass: core.HomeAssistant):
|
|||
), patch_bond_action_returns_clientresponseerror(), patch_bond_device_state():
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
SERVICE_SET_LIGHT_POWER_BELIEF,
|
||||
SERVICE_SET_LIGHT_POWER_TRACKED_STATE,
|
||||
{ATTR_ENTITY_ID: "light.name_1", ATTR_POWER_STATE: False},
|
||||
blocking=True,
|
||||
)
|
||||
|
@ -541,7 +541,7 @@ async def test_fp_light_set_brightness_belief_brightnes_not_supported(
|
|||
with pytest.raises(HomeAssistantError), patch_bond_device_state():
|
||||
await hass.services.async_call(
|
||||
DOMAIN,
|
||||
SERVICE_SET_LIGHT_BRIGHTNESS_BELIEF,
|
||||
SERVICE_SET_LIGHT_BRIGHTNESS_TRACKED_STATE,
|
||||
{ATTR_ENTITY_ID: "light.name_1", ATTR_BRIGHTNESS: 255},
|
||||
blocking=True,
|
||||
)
|
||||
|
|
|
@ -8,7 +8,7 @@ from homeassistant import core
|
|||
from homeassistant.components.bond.const import (
|
||||
ATTR_POWER_STATE,
|
||||
DOMAIN as BOND_DOMAIN,
|
||||
SERVICE_SET_POWER_BELIEF,
|
||||
SERVICE_SET_POWER_TRACKED_STATE,
|
||||
)
|
||||
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN
|
||||
from homeassistant.const import ATTR_ENTITY_ID, SERVICE_TURN_OFF, SERVICE_TURN_ON
|
||||
|
@ -93,7 +93,7 @@ async def test_switch_set_power_belief(hass: core.HomeAssistant):
|
|||
with patch_bond_action() as mock_bond_action, patch_bond_device_state():
|
||||
await hass.services.async_call(
|
||||
BOND_DOMAIN,
|
||||
SERVICE_SET_POWER_BELIEF,
|
||||
SERVICE_SET_POWER_TRACKED_STATE,
|
||||
{ATTR_ENTITY_ID: "switch.name_1", ATTR_POWER_STATE: False},
|
||||
blocking=True,
|
||||
)
|
||||
|
@ -115,7 +115,7 @@ async def test_switch_set_power_belief_api_error(hass: core.HomeAssistant):
|
|||
), patch_bond_action_returns_clientresponseerror(), patch_bond_device_state():
|
||||
await hass.services.async_call(
|
||||
BOND_DOMAIN,
|
||||
SERVICE_SET_POWER_BELIEF,
|
||||
SERVICE_SET_POWER_TRACKED_STATE,
|
||||
{ATTR_ENTITY_ID: "switch.name_1", ATTR_POWER_STATE: False},
|
||||
blocking=True,
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue