From 41b25a765c8870e50349e60bd921a64ea3dbdd72 Mon Sep 17 00:00:00 2001 From: joshs85 Date: Sun, 12 Sep 2021 21:46:43 -0400 Subject: [PATCH] Changed wording of bond state belief feature from belief to tracked state (#56147) Co-authored-by: J. Nick Koston --- homeassistant/components/bond/const.py | 8 +++--- homeassistant/components/bond/fan.py | 4 +-- homeassistant/components/bond/light.py | 8 +++--- homeassistant/components/bond/services.yaml | 32 ++++++++++----------- homeassistant/components/bond/switch.py | 10 +++++-- tests/components/bond/test_fan.py | 8 +++--- tests/components/bond/test_light.py | 28 +++++++++--------- tests/components/bond/test_switch.py | 6 ++-- 8 files changed, 55 insertions(+), 49 deletions(-) diff --git a/homeassistant/components/bond/const.py b/homeassistant/components/bond/const.py index bf1af003e96..4d886c2ee77 100644 --- a/homeassistant/components/bond/const.py +++ b/homeassistant/components/bond/const.py @@ -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" diff --git a/homeassistant/components/bond/fan.py b/homeassistant/components/bond/fan.py index a5e10cd371a..b5d7059b67e 100644 --- a/homeassistant/components/bond/fan.py +++ b/homeassistant/components/bond/fan.py @@ -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", ) diff --git a/homeassistant/components/bond/light.py b/homeassistant/components/bond/light.py index c47147a5648..82bfa24e44d 100644 --- a/homeassistant/components/bond/light.py +++ b/homeassistant/components/bond/light.py @@ -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", ) diff --git a/homeassistant/components/bond/services.yaml b/homeassistant/components/bond/services.yaml index 32a3e882739..4ad2b4f9bb3 100644 --- a/homeassistant/components/bond/services.yaml +++ b/homeassistant/components/bond/services.yaml @@ -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 diff --git a/homeassistant/components/bond/switch.py b/homeassistant/components/bond/switch.py index b493ac07945..01c224d8307 100644 --- a/homeassistant/components/bond/switch.py +++ b/homeassistant/components/bond/switch.py @@ -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", ) diff --git a/tests/components/bond/test_fan.py b/tests/components/bond/test_fan.py index e975f586ff4..d24128617d2 100644 --- a/tests/components/bond/test_fan.py +++ b/tests/components/bond/test_fan.py @@ -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, ) diff --git a/tests/components/bond/test_light.py b/tests/components/bond/test_light.py index 3b846f3d996..e0ca9a05425 100644 --- a/tests/components/bond/test_light.py +++ b/tests/components/bond/test_light.py @@ -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, ) diff --git a/tests/components/bond/test_switch.py b/tests/components/bond/test_switch.py index f2ed6e9c3b5..619eac69e71 100644 --- a/tests/components/bond/test_switch.py +++ b/tests/components/bond/test_switch.py @@ -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, )