Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion homeassistant/components/plugwise/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"iot_class": "local_polling",
"loggers": ["plugwise"],
"quality_scale": "platinum",
"requirements": ["plugwise==1.8.3"],
"requirements": ["plugwise==1.9.0"],
"zeroconf": ["_plugwise._tcp.local."]
}
2 changes: 1 addition & 1 deletion requirements_all.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion requirements_test_all.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions tests/components/plugwise/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,34 @@ def mock_smile_anna(chosen_env: str, cooling_present: bool) -> Generator[MagicMo
yield api


@pytest.fixture
def mock_smile_anna_p1() -> Generator[MagicMock]:
"""Create a Mock Anna-P1 type for testing."""
chosen_env = "anna_p1"
data = _read_json(chosen_env, "data")
with patch(
"homeassistant.components.plugwise.coordinator.Smile", autospec=True
) as api_mock:
api = api_mock.return_value

api.async_update.return_value = data
api.connect.return_value = Version("4.4.4")
api.cooling_present = False
api.gateway_id = "53130847be2f436cb946b78dedb9053a"
api.heater_id = "36b937e44ad145bab165fa0fe99d742d"
api.reboot = True
api.smile = build_smile(
hostname="smile98765",
model="Gateway",
model_id="smile_thermo",
name="Smile Anna P1",
type="thermostat",
version="4.4.4",
)

yield api


@pytest.fixture
def mock_smile_p1(chosen_env: str, gateway_id: str) -> Generator[MagicMock]:
"""Create a base Mock P1 type for testing with different datasets and gateway-ids."""
Expand Down
104 changes: 104 additions & 0 deletions tests/components/plugwise/fixtures/anna_p1/data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
{
"1e5e55b958ac445583602f767cb45942": {
"active_preset": "home",
"available_schedules": ["Thermostat schedule", "off"],
"climate_mode": "heat",
"control_state": "idle",
"dev_class": "thermostat",
"firmware": "2018-02-08T11:15:53+01:00",
"hardware": "6539-1301-500",
"location": "5b13651d79c4454684fd268850b1bff8",
"model": "ThermoTouch",
"name": "Anna",
"preset_modes": ["home", "asleep", "away", "vacation", "no_frost"],
"select_schedule": "off",
"sensors": {
"illuminance": 2.0,
"setpoint": 19.0,
"temperature": 19.4
},
"temperature_offset": {
"lower_bound": -2.0,
"resolution": 0.1,
"setpoint": 0.0,
"upper_bound": 2.0
},
"thermostat": {
"lower_bound": 4.0,
"resolution": 0.1,
"setpoint": 19.0,
"upper_bound": 30.0
},
"vendor": "Plugwise"
},
"36b937e44ad145bab165fa0fe99d742d": {
"available": true,
"binary_sensors": {
"dhw_state": false,
"flame_state": false,
"heating_state": false
},
"dev_class": "heater_central",
"location": "da7be222ab3b420c927f3e49fade0304",
"model": "Generic heater",
"model_id": "HR24",
"name": "OpenTherm",
"sensors": {
"intended_boiler_temperature": 0.0,
"modulation_level": 0.0,
"water_pressure": 6.0,
"water_temperature": 35.0
},
"switches": {
"dhw_cm_switch": true
},
"vendor": "Intergas"
},
"53130847be2f436cb946b78dedb9053a": {
"binary_sensors": {
"plugwise_notification": false
},
"dev_class": "gateway",
"firmware": "4.4.4",
"hardware": "AME Smile 2.0 board",
"location": "da7be222ab3b420c927f3e49fade0304",
"mac_address": "C493000ABCD",
"model": "Gateway",
"model_id": "smile_thermo",
"name": "Smile Anna P1",
"notifications": {},
"sensors": {
"outdoor_temperature": 11.8
},
"vendor": "Plugwise"
},
"da7be222ab3b420c927f3e49fade0304": {
"available": true,
"dev_class": "smartmeter",
"location": "da7be222ab3b420c927f3e49fade0304",
"model": "2MS212 SMR5.5",
"name": "P1",
"sensors": {
"electricity_consumed_off_peak_cumulative": 618.001,
"electricity_consumed_off_peak_interval": 7,
"electricity_consumed_off_peak_point": 393,
"electricity_consumed_peak_cumulative": 576.014,
"electricity_consumed_peak_interval": 0,
"electricity_consumed_peak_point": 0,
"electricity_phase_one_consumed": 393,
"electricity_phase_one_produced": 0,
"electricity_produced_off_peak_cumulative": 246.504,
"electricity_produced_off_peak_interval": 0,
"electricity_produced_off_peak_point": 0,
"electricity_produced_peak_cumulative": 709.442,
"electricity_produced_peak_interval": 0,
"electricity_produced_peak_point": 0,
"gas_consumed_cumulative": 25.37,
"gas_consumed_interval": 0.01,
"net_electricity_cumulative": 238.069,
"net_electricity_point": 393,
"voltage_phase_one": 234.6
},
"vendor": "SAGEM"
}
}

This file was deleted.

39 changes: 19 additions & 20 deletions tests/components/plugwise/snapshots/test_climate.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@
'state': 'auto',
})
# ---
# name: test_anna_3_climate_snapshot[platforms0-True-m_anna_heatpump_idle][climate.anna-entry]
# name: test_anna_climate_snapshot[platforms0-True-anna_heatpump_heating][climate.anna-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
Expand Down Expand Up @@ -708,12 +708,12 @@
'unit_of_measurement': None,
})
# ---
# name: test_anna_3_climate_snapshot[platforms0-True-m_anna_heatpump_idle][climate.anna-state]
# name: test_anna_climate_snapshot[platforms0-True-anna_heatpump_heating][climate.anna-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'current_temperature': 23.0,
'current_temperature': 19.3,
'friendly_name': 'Anna',
'hvac_action': <HVACAction.IDLE: 'idle'>,
'hvac_action': <HVACAction.HEATING: 'heating'>,
'hvac_modes': list([
<HVACMode.AUTO: 'auto'>,
<HVACMode.HEAT_COOL: 'heat_cool'>,
Expand Down Expand Up @@ -741,24 +741,24 @@
'state': 'auto',
})
# ---
# name: test_anna_climate_snapshot[platforms0-True-anna_heatpump_heating][climate.anna-entry]
# name: test_anna_p1_climate_snapshot[platforms0][climate.anna-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'hvac_modes': list([
<HVACMode.AUTO: 'auto'>,
<HVACMode.HEAT_COOL: 'heat_cool'>,
<HVACMode.HEAT: 'heat'>,
]),
'max_temp': 30.0,
'min_temp': 4.0,
'preset_modes': list([
'no_frost',
'home',
'away',
'asleep',
'away',
'vacation',
'no_frost',
]),
'target_temp_step': 0.1,
}),
Expand All @@ -785,42 +785,41 @@
'platform': 'plugwise',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': <ClimateEntityFeature: 18>,
'supported_features': <ClimateEntityFeature: 17>,
'translation_key': 'plugwise',
'unique_id': '3cb70739631c4d17a86b8b12e8a5161b-climate',
'unique_id': '1e5e55b958ac445583602f767cb45942-climate',
'unit_of_measurement': None,
})
# ---
# name: test_anna_climate_snapshot[platforms0-True-anna_heatpump_heating][climate.anna-state]
# name: test_anna_p1_climate_snapshot[platforms0][climate.anna-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'current_temperature': 19.3,
'current_temperature': 19.4,
'friendly_name': 'Anna',
'hvac_action': <HVACAction.HEATING: 'heating'>,
'hvac_action': <HVACAction.IDLE: 'idle'>,
'hvac_modes': list([
<HVACMode.AUTO: 'auto'>,
<HVACMode.HEAT_COOL: 'heat_cool'>,
<HVACMode.HEAT: 'heat'>,
]),
'max_temp': 30.0,
'min_temp': 4.0,
'preset_mode': 'home',
'preset_modes': list([
'no_frost',
'home',
'away',
'asleep',
'away',
'vacation',
'no_frost',
]),
'supported_features': <ClimateEntityFeature: 18>,
'target_temp_high': 30.0,
'target_temp_low': 20.5,
'supported_features': <ClimateEntityFeature: 17>,
'target_temp_step': 0.1,
'temperature': 19.0,
}),
'context': <ANY>,
'entity_id': 'climate.anna',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'auto',
'state': 'heat',
})
# ---
Loading
Loading