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
31 changes: 31 additions & 0 deletions tests/test_ariston_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,18 @@ def test_sync_write_endpoints_send_values_to_transport(self):
post.assert_called_once()
self.assertIn("gw-1", post.call_args.args[0])

def test_sync_velis_slp_holiday_endpoint_sends_date_or_clear_value(self):
api = AristonAPI("user", "password", api_url="https://example.test/api/")
endpoint = "https://example.test/api/velis/slpPlantData/gw-1/holiday"

for holiday_end_date in ("2026-12-31T00:00:00", None):
with self.subTest(holiday_end_date=holiday_end_date):
with patch.object(api, "_post") as post:
result = api.set_velis_slp_holiday("gw-1", holiday_end_date)

self.assertIsNone(result)
post.assert_called_once_with(endpoint, {"new": holiday_end_date})

def test_sync_request_empty_response_and_retry_failure_paths(self):
api = AristonAPI("user", "password")
request = api._AristonAPI__request
Expand Down Expand Up @@ -397,6 +409,25 @@ async def run_all():

asyncio.run(run_all())

def test_async_velis_slp_holiday_endpoint_sends_date_or_clear_value(self):
api = AristonAPI("user", "password", api_url="https://example.test/api/")
endpoint = "https://example.test/api/velis/slpPlantData/gw-1/holiday"

async def run_all():
for holiday_end_date in ("2026-12-31T00:00:00", None):
with self.subTest(holiday_end_date=holiday_end_date):
with patch.object(api, "_async_post", new=AsyncMock()) as post:
result = await api.async_set_velis_slp_holiday(
"gw-1", holiday_end_date
)

self.assertIsNone(result)
post.assert_awaited_once_with(
endpoint, {"new": holiday_end_date}
)

asyncio.run(run_all())

def test_async_request_empty_response_and_retry_failure_paths(self):
api = AristonAPI("user", "password")
request = api._AristonAPI__async_request
Expand Down
77 changes: 76 additions & 1 deletion tests/test_device_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

import asyncio
import unittest
from unittest.mock import AsyncMock, Mock
from datetime import date
from unittest.mock import AsyncMock, Mock, call

from ariston.const import (
ConsumptionTimeInterval,
Expand Down Expand Up @@ -360,6 +361,80 @@ async def set_values():
(61, 0),
)

def test_nuos_split_holiday_state_and_sync_async_setters(self):
holiday_end_date = "2026-12-31T00:00:00"
scheduled = self.make_device(
AristonNuosSplitDevice,
{NuosSplitProperties.HOLIDAY_UNTIL: holiday_end_date},
)
self.assertEqual(scheduled.holiday_end_date, holiday_end_date)
self.assertTrue(scheduled.holiday_active)

cleared = self.make_device(
AristonNuosSplitDevice,
{NuosSplitProperties.HOLIDAY_UNTIL: None},
)
self.assertIsNone(cleared.holiday_end_date)
self.assertFalse(cleared.holiday_active)

missing = self.make_device(AristonNuosSplitDevice)
self.assertIsNone(missing.holiday_end_date)
self.assertFalse(missing.holiday_active)

device = self.make_device(AristonNuosSplitDevice)
device.set_holiday(date(2026, 12, 31))
self.assertEqual(device.holiday_end_date, holiday_end_date)
self.assertTrue(device.holiday_active)
device.set_holiday(None)
self.assertIsNone(device.holiday_end_date)
self.assertFalse(device.holiday_active)
device.api.set_velis_slp_holiday.assert_has_calls(
[call("gw-1", holiday_end_date), call("gw-1", None)]
)

async_device = self.make_device(AristonNuosSplitDevice)
async_device.api.async_set_velis_slp_holiday = AsyncMock()

async def set_holidays():
await async_device.async_set_holiday(date(2026, 12, 31))
self.assertEqual(async_device.holiday_end_date, holiday_end_date)
self.assertTrue(async_device.holiday_active)
await async_device.async_set_holiday(None)

asyncio.run(set_holidays())
self.assertIsNone(async_device.holiday_end_date)
self.assertFalse(async_device.holiday_active)
self.assertEqual(
async_device.api.async_set_velis_slp_holiday.await_args_list,
[call("gw-1", holiday_end_date), call("gw-1", None)],
)

def test_nuos_split_green_plus_mode_is_exposed_and_settable(self):
device = self.make_device(AristonNuosSplitDevice)
self.assertEqual(NuosSplitOperativeMode.GREEN_PLUS.value, 6)
self.assertIn(
NuosSplitOperativeMode.GREEN_PLUS.value,
device.water_heater_mode_options,
)
self.assertIn("GREEN_PLUS", device.water_heater_mode_operation_texts)

device.set_water_heater_operation_mode("GREEN_PLUS")
self.assertEqual(
device.data[NuosSplitProperties.MODE], NuosSplitOperativeMode.GREEN_PLUS.value
)
device.api.set_nuos_mode.assert_called_once_with(
"gw-1", NuosSplitOperativeMode.GREEN_PLUS
)

device.api.async_set_nuos_mode = AsyncMock()
asyncio.run(device.async_set_water_heater_operation_mode("GREEN_PLUS"))
self.assertEqual(
device.data[NuosSplitProperties.MODE], NuosSplitOperativeMode.GREEN_PLUS.value
)
device.api.async_set_nuos_mode.assert_awaited_once_with(
"gw-1", NuosSplitOperativeMode.GREEN_PLUS
)

def test_lydos_hybrid_settings_accessors_and_all_commands(self):
setting_keys = (
SeDeviceSettings.SE_MAX_SETPOINT_TEMPERATURE_MIN,
Expand Down
Loading