mirror of
https://github.com/home-assistant/core.git
synced 2026-02-03 22:05:35 +01:00
Fix deflection switch state for Fritz (#161669)
This commit is contained in:
@@ -488,6 +488,9 @@ class FritzBoxDeflectionSwitch(FritzBoxBaseCoordinatorSwitch):
|
||||
async def _async_handle_turn_on_off(self, turn_on: bool) -> None:
|
||||
"""Handle deflection switch."""
|
||||
await self.coordinator.async_set_deflection_enable(self.deflection_id, turn_on)
|
||||
deflection = self.coordinator.data["call_deflections"][self.deflection_id]
|
||||
deflection["Enable"] = "1" if turn_on else "0"
|
||||
self.async_write_ha_state()
|
||||
|
||||
|
||||
class FritzBoxProfileSwitch(FritzDeviceBase, SwitchEntity):
|
||||
|
||||
@@ -967,7 +967,7 @@ MOCK_HOST_ATTRIBUTES_DATA = [
|
||||
MOCK_CALL_DEFLECTION_DATA = {
|
||||
"X_AVM-DE_OnTel1": {
|
||||
"GetDeflections": {
|
||||
"NewDeflectionList": "<List><Item><DeflectionId>0</DeflectionId><Enable>0</Enable><Type>fromAll</Type><Number></Number><DeflectionToNumber>+1234657890</DeflectionToNumber><Mode>eImmediately</Mode><Outgoing></Outgoing><PhonebookID></PhonebookID></Item></List>"
|
||||
"NewDeflectionList": "<List><Item><DeflectionId>0</DeflectionId><Enable>1</Enable><Type>fromAll</Type><Number></Number><DeflectionToNumber>+1234657890</DeflectionToNumber><Mode>eImmediately</Mode><Outgoing></Outgoing><PhonebookID></PhonebookID></Item></List>"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -799,7 +799,7 @@
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'off',
|
||||
'state': 'on',
|
||||
})
|
||||
# ---
|
||||
# name: test_switch_setup[fc_data3][switch.mock_title_port_forward_test_port_mapping-entry]
|
||||
|
||||
@@ -293,7 +293,7 @@ async def test_switch_no_profile_entities_list(
|
||||
) -> None:
|
||||
"""Test Fritz!Tools switches with no profile entities."""
|
||||
|
||||
entity_id = "sswitch.printer_internet_access"
|
||||
entity_id = "switch.printer_internet_access"
|
||||
|
||||
entry = MockConfigEntry(domain=DOMAIN, data=MOCK_USER_DATA)
|
||||
entry.add_to_hass(hass)
|
||||
@@ -364,6 +364,11 @@ async def test_switch_device_no_wan_access(
|
||||
"async_set_allow_wan_access",
|
||||
STATE_ON,
|
||||
),
|
||||
(
|
||||
"switch.mock_title_call_deflection_0",
|
||||
"async_set_deflection_enable",
|
||||
STATE_ON,
|
||||
),
|
||||
],
|
||||
)
|
||||
async def test_switch_turn_on_off(
|
||||
|
||||
Reference in New Issue
Block a user