Use snapshots in devolo_home_control tests (#93202)

This commit is contained in:
Guido Schmitz 2023-05-22 18:16:57 +02:00 committed by GitHub
parent b10e73e2d4
commit 91da7516d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 874 additions and 170 deletions

View File

@ -1,5 +1,4 @@
"""Tests for the devolo_home_control integration.""" """Tests for the devolo_home_control integration."""
from homeassistant.components.devolo_home_control.const import DOMAIN from homeassistant.components.devolo_home_control.const import DOMAIN
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
@ -13,7 +12,9 @@ def configure_integration(hass: HomeAssistant) -> MockConfigEntry:
"password": "test-password", "password": "test-password",
"mydevolo_url": "https://test_mydevolo_url.test", "mydevolo_url": "https://test_mydevolo_url.test",
} }
entry = MockConfigEntry(domain=DOMAIN, data=config, unique_id="123456") entry = MockConfigEntry(
domain=DOMAIN, data=config, entry_id="123456", unique_id="123456"
)
entry.add_to_hass(hass) entry.add_to_hass(hass)
return entry return entry

View File

@ -0,0 +1,129 @@
# serializer version: 1
# name: test_binary_sensor
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'door',
'friendly_name': 'Test Door',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.test_door',
'last_changed': <ANY>,
'last_updated': <ANY>,
'state': 'off',
})
# ---
# name: test_binary_sensor.1
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'binary_sensor',
'entity_category': None,
'entity_id': 'binary_sensor.test_door',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'name': None,
'options': dict({
}),
'original_device_class': <BinarySensorDeviceClass.DOOR: 'door'>,
'original_icon': None,
'original_name': 'Door',
'platform': 'devolo_home_control',
'supported_features': 0,
'translation_key': None,
'unique_id': 'Test',
'unit_of_measurement': None,
})
# ---
# name: test_binary_sensor.2
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'safety',
'friendly_name': 'Test Overload',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.test_overload',
'last_changed': <ANY>,
'last_updated': <ANY>,
'state': 'off',
})
# ---
# name: test_binary_sensor.3
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'binary_sensor',
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
'entity_id': 'binary_sensor.test_overload',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'name': None,
'options': dict({
}),
'original_device_class': <BinarySensorDeviceClass.SAFETY: 'safety'>,
'original_icon': None,
'original_name': 'Overload',
'platform': 'devolo_home_control',
'supported_features': 0,
'translation_key': None,
'unique_id': 'Overload',
'unit_of_measurement': None,
})
# ---
# name: test_remote_control
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'Test Button 1',
}),
'context': <ANY>,
'entity_id': 'binary_sensor.test_button_1',
'last_changed': <ANY>,
'last_updated': <ANY>,
'state': 'off',
})
# ---
# name: test_remote_control.1
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'binary_sensor',
'entity_category': None,
'entity_id': 'binary_sensor.test_button_1',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'name': None,
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Button 1',
'platform': 'devolo_home_control',
'supported_features': 0,
'translation_key': None,
'unique_id': 'Test_1',
'unit_of_measurement': None,
})
# ---

View File

@ -0,0 +1,59 @@
# serializer version: 1
# name: test_climate
StateSnapshot({
'attributes': ReadOnlyDict({
'current_temperature': 20,
'friendly_name': 'Test',
'hvac_modes': list([
<HVACMode.HEAT: 'heat'>,
]),
'max_temp': 24,
'min_temp': 4,
'supported_features': <ClimateEntityFeature: 1>,
'target_temp_step': 0.5,
'temperature': 20,
}),
'context': <ANY>,
'entity_id': 'climate.test',
'last_changed': <ANY>,
'last_updated': <ANY>,
'state': 'heat',
})
# ---
# name: test_climate.1
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'hvac_modes': list([
<HVACMode.HEAT: 'heat'>,
]),
'max_temp': 24,
'min_temp': 4,
'target_temp_step': 0.5,
}),
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'climate',
'entity_category': None,
'entity_id': 'climate.test',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'name': None,
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': None,
'platform': 'devolo_home_control',
'supported_features': <ClimateEntityFeature: 1>,
'translation_key': None,
'unique_id': 'Test',
'unit_of_measurement': None,
})
# ---

View File

@ -0,0 +1,46 @@
# serializer version: 1
# name: test_cover
StateSnapshot({
'attributes': ReadOnlyDict({
'current_position': 20,
'device_class': 'blind',
'friendly_name': 'Test',
'supported_features': <CoverEntityFeature: 7>,
}),
'context': <ANY>,
'entity_id': 'cover.test',
'last_changed': <ANY>,
'last_updated': <ANY>,
'state': 'open',
})
# ---
# name: test_cover.1
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'cover',
'entity_category': None,
'entity_id': 'cover.test',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'name': None,
'options': dict({
}),
'original_device_class': <CoverDeviceClass.BLIND: 'blind'>,
'original_icon': None,
'original_name': None,
'platform': 'devolo_home_control',
'supported_features': <CoverEntityFeature: 7>,
'translation_key': None,
'unique_id': 'devolo.Blinds',
'unit_of_measurement': None,
})
# ---

View File

@ -0,0 +1,53 @@
# serializer version: 1
# name: test_entry_diagnostics
dict({
'device_info': list([
dict({
'devices': list([
dict({
'device_id': 'Test',
'device_model_uid': 'Test',
'device_type': 'Test',
'name': 'Test Device',
}),
dict({
'device_id': 'Overload',
'device_model_uid': 'Test',
'device_type': 'Test',
'name': 'Test Device',
}),
]),
'gateway': dict({
'firmware_version': '8.94.0',
'local_connection': True,
}),
}),
dict({
'devices': list([
]),
'gateway': dict({
'firmware_version': '8.94.0',
'local_connection': True,
}),
}),
]),
'entry': dict({
'data': dict({
'mydevolo_url': 'https://test_mydevolo_url.test',
'password': '**REDACTED**',
'username': '**REDACTED**',
}),
'disabled_by': None,
'domain': 'devolo_home_control',
'entry_id': '123456',
'options': dict({
}),
'pref_disable_new_entities': False,
'pref_disable_polling': False,
'source': 'user',
'title': 'Mock Title',
'unique_id': '123456',
'version': 1,
}),
})
# ---

View File

@ -0,0 +1,105 @@
# serializer version: 1
# name: test_light_with_binary_sensor
StateSnapshot({
'attributes': ReadOnlyDict({
'brightness': 51,
'color_mode': <ColorMode.BRIGHTNESS: 'brightness'>,
'friendly_name': 'Test',
'supported_color_modes': list([
<ColorMode.BRIGHTNESS: 'brightness'>,
]),
'supported_features': <LightEntityFeature: 0>,
}),
'context': <ANY>,
'entity_id': 'light.test',
'last_changed': <ANY>,
'last_updated': <ANY>,
'state': 'on',
})
# ---
# name: test_light_with_binary_sensor.1
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'supported_color_modes': list([
<ColorMode.BRIGHTNESS: 'brightness'>,
]),
}),
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'light',
'entity_category': None,
'entity_id': 'light.test',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'name': None,
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': None,
'platform': 'devolo_home_control',
'supported_features': 0,
'translation_key': None,
'unique_id': 'devolo.Dimmer:Test',
'unit_of_measurement': None,
})
# ---
# name: test_light_without_binary_sensor
StateSnapshot({
'attributes': ReadOnlyDict({
'brightness': 51,
'color_mode': <ColorMode.BRIGHTNESS: 'brightness'>,
'friendly_name': 'Test',
'supported_color_modes': list([
<ColorMode.BRIGHTNESS: 'brightness'>,
]),
'supported_features': <LightEntityFeature: 0>,
}),
'context': <ANY>,
'entity_id': 'light.test',
'last_changed': <ANY>,
'last_updated': <ANY>,
'state': 'on',
})
# ---
# name: test_light_without_binary_sensor.1
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'supported_color_modes': list([
<ColorMode.BRIGHTNESS: 'brightness'>,
]),
}),
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'light',
'entity_category': None,
'entity_id': 'light.test',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'name': None,
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': None,
'platform': 'devolo_home_control',
'supported_features': 0,
'translation_key': None,
'unique_id': 'devolo.Dimmer:Test',
'unit_of_measurement': None,
})
# ---

View File

@ -0,0 +1,189 @@
# serializer version: 1
# name: test_battery_sensor
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'battery',
'friendly_name': 'Test Battery level',
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
'unit_of_measurement': '%',
}),
'context': <ANY>,
'entity_id': 'sensor.test_battery_level',
'last_changed': <ANY>,
'last_updated': <ANY>,
'state': '25',
})
# ---
# name: test_battery_sensor.1
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
}),
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'sensor',
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
'entity_id': 'sensor.test_battery_level',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'name': None,
'options': dict({
}),
'original_device_class': <SensorDeviceClass.BATTERY: 'battery'>,
'original_icon': None,
'original_name': 'Battery level',
'platform': 'devolo_home_control',
'supported_features': 0,
'translation_key': None,
'unique_id': 'devolo.BatterySensor:Test',
'unit_of_measurement': '%',
})
# ---
# name: test_consumption_sensor
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'power',
'friendly_name': 'Test Current consumption',
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
'unit_of_measurement': 'W',
}),
'context': <ANY>,
'entity_id': 'sensor.test_current_consumption',
'last_changed': <ANY>,
'last_updated': <ANY>,
'state': '0.0',
})
# ---
# name: test_consumption_sensor.1
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
}),
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'sensor',
'entity_category': None,
'entity_id': 'sensor.test_current_consumption',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'name': None,
'options': dict({
}),
'original_device_class': <SensorDeviceClass.POWER: 'power'>,
'original_icon': None,
'original_name': 'Current consumption',
'platform': 'devolo_home_control',
'supported_features': 0,
'translation_key': None,
'unique_id': 'devolo.Meter:Test_current',
'unit_of_measurement': 'W',
})
# ---
# name: test_consumption_sensor.2
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'energy',
'friendly_name': 'Test Total consumption',
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
'unit_of_measurement': 'kWh',
}),
'context': <ANY>,
'entity_id': 'sensor.test_total_consumption',
'last_changed': <ANY>,
'last_updated': <ANY>,
'state': '0.0',
})
# ---
# name: test_consumption_sensor.3
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
}),
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'sensor',
'entity_category': None,
'entity_id': 'sensor.test_total_consumption',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'name': None,
'options': dict({
}),
'original_device_class': <SensorDeviceClass.ENERGY: 'energy'>,
'original_icon': None,
'original_name': 'Total consumption',
'platform': 'devolo_home_control',
'supported_features': 0,
'translation_key': None,
'unique_id': 'devolo.Meter:Test_total',
'unit_of_measurement': 'kWh',
})
# ---
# name: test_temperature_sensor
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'temperature',
'friendly_name': 'Test Temperature',
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
}),
'context': <ANY>,
'entity_id': 'sensor.test_temperature',
'last_changed': <ANY>,
'last_updated': <ANY>,
'state': '20',
})
# ---
# name: test_temperature_sensor.1
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
}),
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'sensor',
'entity_category': None,
'entity_id': 'sensor.test_temperature',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'name': None,
'options': dict({
}),
'original_device_class': <SensorDeviceClass.TEMPERATURE: 'temperature'>,
'original_icon': None,
'original_name': 'Temperature',
'platform': 'devolo_home_control',
'supported_features': 0,
'translation_key': None,
'unique_id': 'devolo.MultiLevelSensor:Test',
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
})
# ---

View File

@ -0,0 +1,151 @@
# serializer version: 1
# name: test_siren
StateSnapshot({
'attributes': ReadOnlyDict({
'available_tones': list([
0,
]),
'friendly_name': 'Test',
'supported_features': <SirenEntityFeature: 7>,
}),
'context': <ANY>,
'entity_id': 'siren.test',
'last_changed': <ANY>,
'last_updated': <ANY>,
'state': 'off',
})
# ---
# name: test_siren.1
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'available_tones': list([
0,
]),
}),
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'siren',
'entity_category': None,
'entity_id': 'siren.test',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'name': None,
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': None,
'platform': 'devolo_home_control',
'supported_features': <SirenEntityFeature: 7>,
'translation_key': None,
'unique_id': 'devolo.SirenMultiLevelSwitch:Test',
'unit_of_measurement': None,
})
# ---
# name: test_siren_change_default_tone
StateSnapshot({
'attributes': ReadOnlyDict({
'available_tones': list([
0,
]),
'friendly_name': 'Test',
'supported_features': <SirenEntityFeature: 7>,
}),
'context': <ANY>,
'entity_id': 'siren.test',
'last_changed': <ANY>,
'last_updated': <ANY>,
'state': 'off',
})
# ---
# name: test_siren_change_default_tone.1
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'available_tones': list([
0,
]),
}),
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'siren',
'entity_category': None,
'entity_id': 'siren.test',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'name': None,
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': None,
'platform': 'devolo_home_control',
'supported_features': <SirenEntityFeature: 7>,
'translation_key': None,
'unique_id': 'devolo.SirenMultiLevelSwitch:Test',
'unit_of_measurement': None,
})
# ---
# name: test_siren_switching
StateSnapshot({
'attributes': ReadOnlyDict({
'available_tones': list([
0,
]),
'friendly_name': 'Test',
'supported_features': <SirenEntityFeature: 7>,
}),
'context': <ANY>,
'entity_id': 'siren.test',
'last_changed': <ANY>,
'last_updated': <ANY>,
'state': 'off',
})
# ---
# name: test_siren_switching.1
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'available_tones': list([
0,
]),
}),
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'siren',
'entity_category': None,
'entity_id': 'siren.test',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'name': None,
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': None,
'platform': 'devolo_home_control',
'supported_features': <SirenEntityFeature: 7>,
'translation_key': None,
'unique_id': 'devolo.SirenMultiLevelSwitch:Test',
'unit_of_measurement': None,
})
# ---

View File

@ -0,0 +1,43 @@
# serializer version: 1
# name: test_switch
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'Test',
}),
'context': <ANY>,
'entity_id': 'switch.test',
'last_changed': <ANY>,
'last_updated': <ANY>,
'state': 'off',
})
# ---
# name: test_switch.1
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'switch',
'entity_category': None,
'entity_id': 'switch.test',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'name': None,
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': None,
'platform': 'devolo_home_control',
'supported_features': 0,
'translation_key': None,
'unique_id': 'devolo.BinarySwitch:Test',
'unit_of_measurement': None,
})
# ---

View File

@ -2,15 +2,10 @@
from unittest.mock import patch from unittest.mock import patch
import pytest import pytest
from syrupy.assertion import SnapshotAssertion
from homeassistant.components.binary_sensor import DOMAIN from homeassistant.components.binary_sensor import DOMAIN
from homeassistant.const import ( from homeassistant.const import STATE_OFF, STATE_ON, STATE_UNAVAILABLE
ATTR_FRIENDLY_NAME,
STATE_OFF,
STATE_ON,
STATE_UNAVAILABLE,
EntityCategory,
)
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_registry as er from homeassistant.helpers import entity_registry as er
@ -25,7 +20,7 @@ from .mocks import (
@pytest.mark.usefixtures("mock_zeroconf") @pytest.mark.usefixtures("mock_zeroconf")
async def test_binary_sensor( async def test_binary_sensor(
hass: HomeAssistant, entity_registry: er.EntityRegistry hass: HomeAssistant, entity_registry: er.EntityRegistry, snapshot: SnapshotAssertion
) -> None: ) -> None:
"""Test setup and state change of a binary sensor device.""" """Test setup and state change of a binary sensor device."""
entry = configure_integration(hass) entry = configure_integration(hass)
@ -39,17 +34,12 @@ async def test_binary_sensor(
await hass.async_block_till_done() await hass.async_block_till_done()
state = hass.states.get(f"{DOMAIN}.test_door") state = hass.states.get(f"{DOMAIN}.test_door")
assert state is not None assert state == snapshot
assert state.state == STATE_OFF assert entity_registry.async_get(f"{DOMAIN}.test_door") == snapshot
assert state.attributes[ATTR_FRIENDLY_NAME] == "Test Door"
state = hass.states.get(f"{DOMAIN}.test_overload") state = hass.states.get(f"{DOMAIN}.test_overload")
assert state is not None assert state == snapshot
assert state.attributes[ATTR_FRIENDLY_NAME] == "Test Overload" assert entity_registry.async_get(f"{DOMAIN}.test_overload") == snapshot
assert (
entity_registry.async_get(f"{DOMAIN}.test_overload").entity_category
== EntityCategory.DIAGNOSTIC
)
# Emulate websocket message: sensor turned on # Emulate websocket message: sensor turned on
test_gateway.publisher.dispatch("Test", ("Test", True)) test_gateway.publisher.dispatch("Test", ("Test", True))
@ -64,7 +54,9 @@ async def test_binary_sensor(
@pytest.mark.usefixtures("mock_zeroconf") @pytest.mark.usefixtures("mock_zeroconf")
async def test_remote_control(hass: HomeAssistant) -> None: async def test_remote_control(
hass: HomeAssistant, entity_registry: er.EntityRegistry, snapshot: SnapshotAssertion
) -> None:
"""Test setup and state change of a remote control device.""" """Test setup and state change of a remote control device."""
entry = configure_integration(hass) entry = configure_integration(hass)
test_gateway = HomeControlMockRemoteControl() test_gateway = HomeControlMockRemoteControl()
@ -77,9 +69,8 @@ async def test_remote_control(hass: HomeAssistant) -> None:
await hass.async_block_till_done() await hass.async_block_till_done()
state = hass.states.get(f"{DOMAIN}.test_button_1") state = hass.states.get(f"{DOMAIN}.test_button_1")
assert state is not None assert state == snapshot
assert state.state == STATE_OFF assert entity_registry.async_get(f"{DOMAIN}.test_button_1") == snapshot
assert state.attributes[ATTR_FRIENDLY_NAME] == "Test Button 1"
# Emulate websocket message: button pressed # Emulate websocket message: button pressed
test_gateway.publisher.dispatch("Test", ("Test", 1)) test_gateway.publisher.dispatch("Test", ("Test", 1))

View File

@ -1,25 +1,25 @@
"""Tests for the devolo Home Control climate.""" """Tests for the devolo Home Control climate."""
from unittest.mock import patch from unittest.mock import patch
from syrupy.assertion import SnapshotAssertion
from homeassistant.components.climate import ( from homeassistant.components.climate import (
ATTR_HVAC_MODE, ATTR_HVAC_MODE,
DOMAIN, DOMAIN,
SERVICE_SET_TEMPERATURE, SERVICE_SET_TEMPERATURE,
HVACMode, HVACMode,
) )
from homeassistant.const import ( from homeassistant.const import ATTR_ENTITY_ID, ATTR_TEMPERATURE, STATE_UNAVAILABLE
ATTR_ENTITY_ID,
ATTR_FRIENDLY_NAME,
ATTR_TEMPERATURE,
STATE_UNAVAILABLE,
)
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_registry as er
from . import configure_integration from . import configure_integration
from .mocks import HomeControlMock, HomeControlMockClimate from .mocks import HomeControlMock, HomeControlMockClimate
async def test_climate(hass: HomeAssistant) -> None: async def test_climate(
hass: HomeAssistant, entity_registry: er.EntityRegistry, snapshot: SnapshotAssertion
) -> None:
"""Test setup and state change of a climate device.""" """Test setup and state change of a climate device."""
entry = configure_integration(hass) entry = configure_integration(hass)
test_gateway = HomeControlMockClimate() test_gateway = HomeControlMockClimate()
@ -32,10 +32,8 @@ async def test_climate(hass: HomeAssistant) -> None:
await hass.async_block_till_done() await hass.async_block_till_done()
state = hass.states.get(f"{DOMAIN}.test") state = hass.states.get(f"{DOMAIN}.test")
assert state is not None assert state == snapshot
assert state.state == HVACMode.HEAT assert entity_registry.async_get(f"{DOMAIN}.test") == snapshot
assert state.attributes[ATTR_TEMPERATURE] == test_gateway.devices["Test"].value
assert state.attributes[ATTR_FRIENDLY_NAME] == "Test"
# Emulate websocket message: temperature changed # Emulate websocket message: temperature changed
test_gateway.publisher.dispatch("Test", ("Test", 21.0)) test_gateway.publisher.dispatch("Test", ("Test", 21.0))

View File

@ -1,24 +1,27 @@
"""Tests for the devolo Home Control cover platform.""" """Tests for the devolo Home Control cover platform."""
from unittest.mock import patch from unittest.mock import patch
from syrupy.assertion import SnapshotAssertion
from homeassistant.components.cover import ATTR_CURRENT_POSITION, ATTR_POSITION, DOMAIN from homeassistant.components.cover import ATTR_CURRENT_POSITION, ATTR_POSITION, DOMAIN
from homeassistant.const import ( from homeassistant.const import (
ATTR_ENTITY_ID, ATTR_ENTITY_ID,
ATTR_FRIENDLY_NAME,
SERVICE_CLOSE_COVER, SERVICE_CLOSE_COVER,
SERVICE_OPEN_COVER, SERVICE_OPEN_COVER,
SERVICE_SET_COVER_POSITION, SERVICE_SET_COVER_POSITION,
STATE_CLOSED, STATE_CLOSED,
STATE_OPEN,
STATE_UNAVAILABLE, STATE_UNAVAILABLE,
) )
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_registry as er
from . import configure_integration from . import configure_integration
from .mocks import HomeControlMock, HomeControlMockCover from .mocks import HomeControlMock, HomeControlMockCover
async def test_cover(hass: HomeAssistant) -> None: async def test_cover(
hass: HomeAssistant, entity_registry: er.EntityRegistry, snapshot: SnapshotAssertion
) -> None:
"""Test setup and state change of a cover device.""" """Test setup and state change of a cover device."""
entry = configure_integration(hass) entry = configure_integration(hass)
test_gateway = HomeControlMockCover() test_gateway = HomeControlMockCover()
@ -31,15 +34,8 @@ async def test_cover(hass: HomeAssistant) -> None:
await hass.async_block_till_done() await hass.async_block_till_done()
state = hass.states.get(f"{DOMAIN}.test") state = hass.states.get(f"{DOMAIN}.test")
assert state is not None assert state == snapshot
assert state.state == STATE_OPEN assert entity_registry.async_get(f"{DOMAIN}.test") == snapshot
assert state.attributes[ATTR_FRIENDLY_NAME] == "Test"
assert (
state.attributes[ATTR_CURRENT_POSITION]
== test_gateway.devices["Test"]
.multi_level_switch_property["devolo.Blinds"]
.value
)
# Emulate websocket message: position changed # Emulate websocket message: position changed
test_gateway.publisher.dispatch("Test", ("devolo.Blinds", 0.0)) test_gateway.publisher.dispatch("Test", ("devolo.Blinds", 0.0))

View File

@ -3,10 +3,8 @@ from __future__ import annotations
from unittest.mock import patch from unittest.mock import patch
from aiohttp import ClientSession from syrupy.assertion import SnapshotAssertion
from homeassistant.components.devolo_home_control.diagnostics import TO_REDACT
from homeassistant.components.diagnostics import REDACTED
from homeassistant.config_entries import ConfigEntryState from homeassistant.config_entries import ConfigEntryState
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
@ -14,9 +12,14 @@ from . import configure_integration
from .mocks import HomeControlMock, HomeControlMockBinarySensor from .mocks import HomeControlMock, HomeControlMockBinarySensor
from tests.components.diagnostics import get_diagnostics_for_config_entry from tests.components.diagnostics import get_diagnostics_for_config_entry
from tests.typing import ClientSessionGenerator
async def test_entry_diagnostics(hass: HomeAssistant, hass_client: ClientSession): async def test_entry_diagnostics(
hass: HomeAssistant,
hass_client: ClientSessionGenerator,
snapshot: SnapshotAssertion,
) -> None:
"""Test setup and state change of a climate device.""" """Test setup and state change of a climate device."""
entry = configure_integration(hass) entry = configure_integration(hass)
gateway_1 = HomeControlMockBinarySensor() gateway_1 = HomeControlMockBinarySensor()
@ -30,36 +33,5 @@ async def test_entry_diagnostics(hass: HomeAssistant, hass_client: ClientSession
assert entry.state == ConfigEntryState.LOADED assert entry.state == ConfigEntryState.LOADED
entry_dict = entry.as_dict()
for key in TO_REDACT:
entry_dict["data"][key] = REDACTED
result = await get_diagnostics_for_config_entry(hass, hass_client, entry) result = await get_diagnostics_for_config_entry(hass, hass_client, entry)
assert result == snapshot
assert result == {
"entry": entry_dict,
"device_info": [
{
"gateway": {
"local_connection": gateway_1.gateway.local_connection,
"firmware_version": gateway_1.gateway.firmware_version,
},
"devices": [
{
"device_id": device_id,
"device_model_uid": properties.device_model_uid,
"device_type": properties.device_type,
"name": properties.name,
}
for device_id, properties in gateway_1.devices.items()
],
},
{
"gateway": {
"local_connection": gateway_2.gateway.local_connection,
"firmware_version": gateway_2.gateway.firmware_version,
},
"devices": [],
},
],
}

View File

@ -1,16 +1,11 @@
"""Tests for the devolo Home Control light platform.""" """Tests for the devolo Home Control light platform."""
from unittest.mock import patch from unittest.mock import patch
from homeassistant.components.light import ( from syrupy.assertion import SnapshotAssertion
ATTR_BRIGHTNESS,
ATTR_COLOR_MODE, from homeassistant.components.light import ATTR_BRIGHTNESS, DOMAIN
ATTR_SUPPORTED_COLOR_MODES,
DOMAIN,
ColorMode,
)
from homeassistant.const import ( from homeassistant.const import (
ATTR_ENTITY_ID, ATTR_ENTITY_ID,
ATTR_FRIENDLY_NAME,
SERVICE_TURN_OFF, SERVICE_TURN_OFF,
SERVICE_TURN_ON, SERVICE_TURN_ON,
STATE_OFF, STATE_OFF,
@ -18,12 +13,15 @@ from homeassistant.const import (
STATE_UNAVAILABLE, STATE_UNAVAILABLE,
) )
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_registry as er
from . import configure_integration from . import configure_integration
from .mocks import BinarySwitchPropertyMock, HomeControlMock, HomeControlMockLight from .mocks import BinarySwitchPropertyMock, HomeControlMock, HomeControlMockLight
async def test_light_without_binary_sensor(hass: HomeAssistant) -> None: async def test_light_without_binary_sensor(
hass: HomeAssistant, entity_registry: er.EntityRegistry, snapshot: SnapshotAssertion
) -> None:
"""Test setup and state change of a light device that does not have an additional binary sensor.""" """Test setup and state change of a light device that does not have an additional binary sensor."""
entry = configure_integration(hass) entry = configure_integration(hass)
test_gateway = HomeControlMockLight() test_gateway = HomeControlMockLight()
@ -35,18 +33,8 @@ async def test_light_without_binary_sensor(hass: HomeAssistant) -> None:
await hass.async_block_till_done() await hass.async_block_till_done()
state = hass.states.get(f"{DOMAIN}.test") state = hass.states.get(f"{DOMAIN}.test")
assert state is not None assert state == snapshot
assert state.state == STATE_ON assert entity_registry.async_get(f"{DOMAIN}.test") == snapshot
assert state.attributes[ATTR_FRIENDLY_NAME] == "Test"
assert state.attributes[ATTR_COLOR_MODE] == ColorMode.BRIGHTNESS
assert state.attributes[ATTR_SUPPORTED_COLOR_MODES] == [ColorMode.BRIGHTNESS]
assert state.attributes[ATTR_BRIGHTNESS] == round(
test_gateway.devices["Test"]
.multi_level_switch_property["devolo.Dimmer:Test"]
.value
/ 100
* 255
)
# Emulate websocket message: brightness changed # Emulate websocket message: brightness changed
test_gateway.publisher.dispatch("Test", ("devolo.Dimmer:Test", 0.0)) test_gateway.publisher.dispatch("Test", ("devolo.Dimmer:Test", 0.0))
@ -96,7 +84,9 @@ async def test_light_without_binary_sensor(hass: HomeAssistant) -> None:
assert hass.states.get(f"{DOMAIN}.test").state == STATE_UNAVAILABLE assert hass.states.get(f"{DOMAIN}.test").state == STATE_UNAVAILABLE
async def test_light_with_binary_sensor(hass: HomeAssistant) -> None: async def test_light_with_binary_sensor(
hass: HomeAssistant, entity_registry: er.EntityRegistry, snapshot: SnapshotAssertion
) -> None:
"""Test setup and state change of a light device that has an additional binary sensor.""" """Test setup and state change of a light device that has an additional binary sensor."""
entry = configure_integration(hass) entry = configure_integration(hass)
test_gateway = HomeControlMockLight() test_gateway = HomeControlMockLight()
@ -111,8 +101,8 @@ async def test_light_with_binary_sensor(hass: HomeAssistant) -> None:
await hass.async_block_till_done() await hass.async_block_till_done()
state = hass.states.get(f"{DOMAIN}.test") state = hass.states.get(f"{DOMAIN}.test")
assert state is not None assert state == snapshot
assert state.state == STATE_ON assert entity_registry.async_get(f"{DOMAIN}.test") == snapshot
# Emulate websocket message: brightness changed # Emulate websocket message: brightness changed
test_gateway.publisher.dispatch("Test", ("devolo.Dimmer:Test", 0.0)) test_gateway.publisher.dispatch("Test", ("devolo.Dimmer:Test", 0.0))

View File

@ -1,19 +1,10 @@
"""Tests for the devolo Home Control sensor platform.""" """Tests for the devolo Home Control sensor platform."""
from unittest.mock import patch from unittest.mock import patch
from homeassistant.components.sensor import ( from syrupy.assertion import SnapshotAssertion
ATTR_STATE_CLASS,
DOMAIN, from homeassistant.components.sensor import DOMAIN
SensorDeviceClass, from homeassistant.const import STATE_UNAVAILABLE
SensorStateClass,
)
from homeassistant.const import (
ATTR_DEVICE_CLASS,
ATTR_UNIT_OF_MEASUREMENT,
PERCENTAGE,
STATE_UNAVAILABLE,
EntityCategory,
)
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_registry as er from homeassistant.helpers import entity_registry as er
@ -21,7 +12,9 @@ from . import configure_integration
from .mocks import HomeControlMock, HomeControlMockConsumption, HomeControlMockSensor from .mocks import HomeControlMock, HomeControlMockConsumption, HomeControlMockSensor
async def test_temperature_sensor(hass: HomeAssistant) -> None: async def test_temperature_sensor(
hass: HomeAssistant, entity_registry: er.EntityRegistry, snapshot: SnapshotAssertion
) -> None:
"""Test setup of a temperature sensor device.""" """Test setup of a temperature sensor device."""
entry = configure_integration(hass) entry = configure_integration(hass)
test_gateway = HomeControlMockSensor() test_gateway = HomeControlMockSensor()
@ -33,18 +26,12 @@ async def test_temperature_sensor(hass: HomeAssistant) -> None:
await hass.async_block_till_done() await hass.async_block_till_done()
state = hass.states.get(f"{DOMAIN}.test_temperature") state = hass.states.get(f"{DOMAIN}.test_temperature")
assert state is not None assert state == snapshot
assert state.state == str( assert entity_registry.async_get(f"{DOMAIN}.test_temperature") == snapshot
test_gateway.devices["Test"]
.multi_level_sensor_property["devolo.MultiLevelSensor:Test"]
.value
)
assert state.attributes[ATTR_STATE_CLASS] == SensorStateClass.MEASUREMENT
assert state.attributes[ATTR_DEVICE_CLASS] == SensorDeviceClass.TEMPERATURE
async def test_battery_sensor( async def test_battery_sensor(
hass: HomeAssistant, entity_registry: er.EntityRegistry hass: HomeAssistant, entity_registry: er.EntityRegistry, snapshot: SnapshotAssertion
) -> None: ) -> None:
"""Test setup and state change of a battery sensor device.""" """Test setup and state change of a battery sensor device."""
entry = configure_integration(hass) entry = configure_integration(hass)
@ -58,15 +45,8 @@ async def test_battery_sensor(
await hass.async_block_till_done() await hass.async_block_till_done()
state = hass.states.get(f"{DOMAIN}.test_battery_level") state = hass.states.get(f"{DOMAIN}.test_battery_level")
assert state is not None assert state == snapshot
assert state.state == str(test_gateway.devices["Test"].battery_level) assert entity_registry.async_get(f"{DOMAIN}.test_battery_level") == snapshot
assert state.attributes[ATTR_STATE_CLASS] == SensorStateClass.MEASUREMENT
assert state.attributes[ATTR_UNIT_OF_MEASUREMENT] == PERCENTAGE
assert state.attributes[ATTR_DEVICE_CLASS] == SensorDeviceClass.BATTERY
assert (
entity_registry.async_get(f"{DOMAIN}.test_battery_level").entity_category
is EntityCategory.DIAGNOSTIC
)
# Emulate websocket message: value changed # Emulate websocket message: value changed
test_gateway.publisher.dispatch("Test", ("Test", 10, "battery_level")) test_gateway.publisher.dispatch("Test", ("Test", 10, "battery_level"))
@ -74,7 +54,9 @@ async def test_battery_sensor(
assert hass.states.get(f"{DOMAIN}.test_battery_level").state == "10" assert hass.states.get(f"{DOMAIN}.test_battery_level").state == "10"
async def test_consumption_sensor(hass: HomeAssistant) -> None: async def test_consumption_sensor(
hass: HomeAssistant, entity_registry: er.EntityRegistry, snapshot: SnapshotAssertion
) -> None:
"""Test setup and state change of a consumption sensor device.""" """Test setup and state change of a consumption sensor device."""
entry = configure_integration(hass) entry = configure_integration(hass)
test_gateway = HomeControlMockConsumption() test_gateway = HomeControlMockConsumption()
@ -86,20 +68,12 @@ async def test_consumption_sensor(hass: HomeAssistant) -> None:
await hass.async_block_till_done() await hass.async_block_till_done()
state = hass.states.get(f"{DOMAIN}.test_current_consumption") state = hass.states.get(f"{DOMAIN}.test_current_consumption")
assert state is not None assert state == snapshot
assert state.state == str( assert entity_registry.async_get(f"{DOMAIN}.test_current_consumption") == snapshot
test_gateway.devices["Test"].consumption_property["devolo.Meter:Test"].current
)
assert state.attributes[ATTR_STATE_CLASS] == SensorStateClass.MEASUREMENT
assert state.attributes[ATTR_DEVICE_CLASS] == SensorDeviceClass.POWER
state = hass.states.get(f"{DOMAIN}.test_total_consumption") state = hass.states.get(f"{DOMAIN}.test_total_consumption")
assert state is not None assert state == snapshot
assert state.state == str( assert entity_registry.async_get(f"{DOMAIN}.test_total_consumption") == snapshot
test_gateway.devices["Test"].consumption_property["devolo.Meter:Test"].total
)
assert state.attributes[ATTR_STATE_CLASS] == SensorStateClass.TOTAL_INCREASING
assert state.attributes[ATTR_DEVICE_CLASS] == SensorDeviceClass.ENERGY
# Emulate websocket message: value changed # Emulate websocket message: value changed
test_gateway.devices["Test"].consumption_property["devolo.Meter:Test"].total = 50.0 test_gateway.devices["Test"].consumption_property["devolo.Meter:Test"].total = 50.0

View File

@ -2,22 +2,21 @@
from unittest.mock import patch from unittest.mock import patch
import pytest import pytest
from syrupy.assertion import SnapshotAssertion
from homeassistant.components.siren import DOMAIN from homeassistant.components.siren import DOMAIN
from homeassistant.const import ( from homeassistant.const import STATE_OFF, STATE_ON, STATE_UNAVAILABLE
ATTR_FRIENDLY_NAME,
STATE_OFF,
STATE_ON,
STATE_UNAVAILABLE,
)
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_registry as er
from . import configure_integration from . import configure_integration
from .mocks import HomeControlMock, HomeControlMockSiren from .mocks import HomeControlMock, HomeControlMockSiren
@pytest.mark.usefixtures("mock_zeroconf") @pytest.mark.usefixtures("mock_zeroconf")
async def test_siren(hass: HomeAssistant) -> None: async def test_siren(
hass: HomeAssistant, entity_registry: er.EntityRegistry, snapshot: SnapshotAssertion
) -> None:
"""Test setup and state change of a siren device.""" """Test setup and state change of a siren device."""
entry = configure_integration(hass) entry = configure_integration(hass)
test_gateway = HomeControlMockSiren() test_gateway = HomeControlMockSiren()
@ -30,9 +29,8 @@ async def test_siren(hass: HomeAssistant) -> None:
await hass.async_block_till_done() await hass.async_block_till_done()
state = hass.states.get(f"{DOMAIN}.test") state = hass.states.get(f"{DOMAIN}.test")
assert state is not None assert state == snapshot
assert state.state == STATE_OFF assert entity_registry.async_get(f"{DOMAIN}.test") == snapshot
assert state.attributes[ATTR_FRIENDLY_NAME] == "Test"
# Emulate websocket message: sensor turned on # Emulate websocket message: sensor turned on
test_gateway.publisher.dispatch("Test", ("devolo.SirenMultiLevelSwitch:Test", 1)) test_gateway.publisher.dispatch("Test", ("devolo.SirenMultiLevelSwitch:Test", 1))
@ -47,7 +45,9 @@ async def test_siren(hass: HomeAssistant) -> None:
@pytest.mark.usefixtures("mock_zeroconf") @pytest.mark.usefixtures("mock_zeroconf")
async def test_siren_switching(hass: HomeAssistant) -> None: async def test_siren_switching(
hass: HomeAssistant, entity_registry: er.EntityRegistry, snapshot: SnapshotAssertion
) -> None:
"""Test setup and state change via switching of a siren device.""" """Test setup and state change via switching of a siren device."""
entry = configure_integration(hass) entry = configure_integration(hass)
test_gateway = HomeControlMockSiren() test_gateway = HomeControlMockSiren()
@ -60,8 +60,8 @@ async def test_siren_switching(hass: HomeAssistant) -> None:
await hass.async_block_till_done() await hass.async_block_till_done()
state = hass.states.get(f"{DOMAIN}.test") state = hass.states.get(f"{DOMAIN}.test")
assert state is not None assert state == snapshot
assert state.state == STATE_OFF assert entity_registry.async_get(f"{DOMAIN}.test") == snapshot
with patch( with patch(
"devolo_home_control_api.properties.multi_level_switch_property.MultiLevelSwitchProperty.set" "devolo_home_control_api.properties.multi_level_switch_property.MultiLevelSwitchProperty.set"
@ -98,7 +98,9 @@ async def test_siren_switching(hass: HomeAssistant) -> None:
@pytest.mark.usefixtures("mock_zeroconf") @pytest.mark.usefixtures("mock_zeroconf")
async def test_siren_change_default_tone(hass: HomeAssistant) -> None: async def test_siren_change_default_tone(
hass: HomeAssistant, entity_registry: er.EntityRegistry, snapshot: SnapshotAssertion
) -> None:
"""Test changing the default tone on message.""" """Test changing the default tone on message."""
entry = configure_integration(hass) entry = configure_integration(hass)
test_gateway = HomeControlMockSiren() test_gateway = HomeControlMockSiren()
@ -111,7 +113,8 @@ async def test_siren_change_default_tone(hass: HomeAssistant) -> None:
await hass.async_block_till_done() await hass.async_block_till_done()
state = hass.states.get(f"{DOMAIN}.test") state = hass.states.get(f"{DOMAIN}.test")
assert state is not None assert state == snapshot
assert entity_registry.async_get(f"{DOMAIN}.test") == snapshot
with patch( with patch(
"devolo_home_control_api.properties.multi_level_switch_property.MultiLevelSwitchProperty.set" "devolo_home_control_api.properties.multi_level_switch_property.MultiLevelSwitchProperty.set"

View File

@ -1,22 +1,26 @@
"""Tests for the devolo Home Control switch platform.""" """Tests for the devolo Home Control switch platform."""
from unittest.mock import patch from unittest.mock import patch
from syrupy.assertion import SnapshotAssertion
from homeassistant.components.switch import DOMAIN from homeassistant.components.switch import DOMAIN
from homeassistant.const import ( from homeassistant.const import (
ATTR_ENTITY_ID, ATTR_ENTITY_ID,
SERVICE_TURN_OFF, SERVICE_TURN_OFF,
SERVICE_TURN_ON, SERVICE_TURN_ON,
STATE_OFF,
STATE_ON, STATE_ON,
STATE_UNAVAILABLE, STATE_UNAVAILABLE,
) )
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_registry as er
from . import configure_integration from . import configure_integration
from .mocks import HomeControlMock, HomeControlMockSwitch from .mocks import HomeControlMock, HomeControlMockSwitch
async def test_switch(hass: HomeAssistant) -> None: async def test_switch(
hass: HomeAssistant, entity_registry: er.EntityRegistry, snapshot: SnapshotAssertion
) -> None:
"""Test setup and state change of a switch device.""" """Test setup and state change of a switch device."""
entry = configure_integration(hass) entry = configure_integration(hass)
test_gateway = HomeControlMockSwitch() test_gateway = HomeControlMockSwitch()
@ -28,8 +32,8 @@ async def test_switch(hass: HomeAssistant) -> None:
await hass.async_block_till_done() await hass.async_block_till_done()
state = hass.states.get(f"{DOMAIN}.test") state = hass.states.get(f"{DOMAIN}.test")
assert state is not None assert state == snapshot
assert state.state == STATE_OFF assert entity_registry.async_get(f"{DOMAIN}.test") == snapshot
# Emulate websocket message: switched on # Emulate websocket message: switched on
test_gateway.devices["Test"].binary_switch_property[ test_gateway.devices["Test"].binary_switch_property[