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
385 changes: 357 additions & 28 deletions ariston/ariston_api.py

Large diffs are not rendered by default.

30 changes: 27 additions & 3 deletions ariston/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,24 @@

ARISTON_API_URL: Final[str] = "https://www.ariston-net.remotethermo.com/api/v2/"
ARISTON_LOGIN: Final[str] = "accounts/login"
# Web-app (R2) routes. The api/v2 operativeMode endpoint silently drops
# value 0 (GREEN) for Nuos Split — proven 2026-10-18 — while the web app's
# PlantHomeSlp/SetData applies it. GREEN writes go through these routes.
ARISTON_R2_BASE_URL: Final[str] = "https://www.ariston-net.remotethermo.com"
ARISTON_R2_LOGIN_PAGE: Final[str] = ARISTON_R2_BASE_URL + "/R2/Account/Login"
ARISTON_R2_HOME: Final[str] = ARISTON_R2_BASE_URL + "/R2/Home"
ARISTON_R2_SLP_GET_DATA: Final[str] = (
ARISTON_R2_BASE_URL
+ "/R2/PlantHomeSlp/GetData/{0}?fetchSettings=true&fetchTimeProg=true"
)
ARISTON_R2_SLP_SET_DATA: Final[str] = ARISTON_R2_BASE_URL + "/R2/PlantHomeSlp/SetData/{0}"
ARISTON_R2_USER_AGENT: Final[str] = (
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 "
"(KHTML, like Gecko) Chrome/128.0 Safari/537.36"
)
ARISTON_REMOTE: Final[str] = "remote"
ARISTON_VELIS: Final[str] = "velis"
HOLIDAY_DATE_FORMAT: Final[str] = "%Y-%m-%dT00:00:00"
ARISTON_PLANTS: Final[str] = "plants"
ARISTON_LITE: Final[str] = "lite"
ARISTON_DATA_ITEMS: Final[str] = "dataItems"
Expand Down Expand Up @@ -224,14 +240,22 @@ class NuosSplitPlantMode(Enum):
PROGRAM = 2


@unique
class NuosSplitOperativeMode(WaterHeaterMode):
"""NuosSplit operative mode enum"""
"""NuosSplit operative mode enum.

Official range (web app, 2026-10-18): Green=0, Comfort=1, Fast=2,
Auto=3, HcHp=4, Electric=5, GreenPlus=6. Only the modes the device
reliably accepts are exposed; value 3 was mislabeled IMEMORY before.
IMEMORY is kept as a deprecated alias of AUTO so existing callers
(attribute access and the string-based device setter) keep working;
iteration and the mode options stay on the canonical AUTO name.
"""

GREEN = 0
COMFORT = 1
FAST = 2
IMEMORY = 3
AUTO = 3
IMEMORY = 3 # deprecated alias of AUTO (pre-rename public name)
GREEN_PLUS = 6


Expand Down
11 changes: 7 additions & 4 deletions ariston/galevo_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
DeviceProperties,
GasEnergyUnit,
GasType,
HOLIDAY_DATE_FORMAT,
PlantMode,
PropertyType,
ThermostatProperties,
Expand All @@ -43,9 +44,9 @@ def __init__(
super().__init__(api, attributes)
self.umsys = "si" if is_metric else "us"
self.language_tag = language_tag
self.consumptions_settings: dict[str, Any] = dict()
self.energy_account: dict[str, Any] = dict()
self.menu_items: list[dict[str, Any]] = list()
self.consumptions_settings: dict[str, Any] = {}
self.energy_account: dict[str, Any] = {}
self.menu_items: list[dict[str, Any]] = []

@property
def consumption_type(self) -> str:
Expand Down Expand Up @@ -1008,7 +1009,9 @@ async def async_set_item_by_id(
@staticmethod
def _create_holiday_end_date(holiday_end: Optional[date]):
return (
None if holiday_end is None else holiday_end.strftime("%Y-%m-%dT00:00:00")
None
if holiday_end is None
else holiday_end.strftime(HOLIDAY_DATE_FORMAT)
)

def _set_holiday(self, holiday_end_date: Optional[str]):
Expand Down
34 changes: 22 additions & 12 deletions ariston/nuos_split_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,20 +202,30 @@ async def async_set_water_heater_reduced_temperature(self, temperature: float):
await self._async_set_water_heater_temperature(current, temperature)

def set_water_heater_operation_mode(self, operation_mode: str):
"""Set water heater operation mode"""
self.api.set_nuos_mode(self.gw, NuosSplitOperativeMode[operation_mode])
self.data[NuosSplitProperties.MODE] = NuosSplitOperativeMode[
operation_mode
].value
"""Set water heater operation mode.

GREEN (0) goes through the R2 web-app endpoint: the api/v2
operativeMode route silently drops value 0 (proven 2026-10-18).
"""
mode = NuosSplitOperativeMode[operation_mode]
if mode is NuosSplitOperativeMode.GREEN:
self.api.set_nuos_mode_via_r2(self.gw, mode)
else:
self.api.set_nuos_mode(self.gw, mode)
self.data[NuosSplitProperties.OP_MODE] = mode.value

async def async_set_water_heater_operation_mode(self, operation_mode: str):
"""Async set water heater operation mode"""
await self.api.async_set_nuos_mode(
self.gw, NuosSplitOperativeMode[operation_mode]
)
self.data[NuosSplitProperties.MODE] = NuosSplitOperativeMode[
operation_mode
].value
"""Async set water heater operation mode.

GREEN (0) goes through the R2 web-app endpoint: the api/v2
operativeMode route silently drops value 0 (proven 2026-10-18).
"""
mode = NuosSplitOperativeMode[operation_mode]
if mode is NuosSplitOperativeMode.GREEN:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Required: This change routes only the async setter through R2. The synchronous sibling set_water_heater_operation_mode() still calls set_nuos_mode() for GREEN (0), which this PR says the api/v2 route silently ignores. Synchronous callers therefore still cannot set GREEN. Add the equivalent sync R2 path or handle GREEN in the sync setter.

@flupkede flupkede Nov 14, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in f173bcb: added the sync twin — set_nuos_mode_via_r2() (requests-based R2 login/read/POST with the same one-fresh-login retry on a failed read), and the sync set_water_heater_operation_mode() now routes GREEN through it while COMFORT/FAST keep the direct route. The sync local echo also went into MODE before; it now writes OP_MODE like the async setter (mode is the plant-mode field and never changes on an operativeMode write). Covered by 4 new tests: full sync flow (login form → read → envelope with opMode 0), fresh-login retry, and GREEN/COMFORT routing.

await self.api.async_set_nuos_mode_via_r2(self.gw, mode)
else:
await self.api.async_set_nuos_mode(self.gw, mode)
self.data[NuosSplitProperties.OP_MODE] = mode.value

def set_min_setpoint_temp(self, min_setpoint_temp: float):
"""Set water heater minimum setpoint temperature"""
Expand Down
25 changes: 23 additions & 2 deletions ariston/velis_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@

import logging
from abc import ABC, abstractmethod
from datetime import date
from typing import Any, Optional

from .ariston_api import AristonAPI
from .const import VelisDeviceProperties
from .const import HOLIDAY_DATE_FORMAT, VelisDeviceProperties
from .velis_base_device import AristonVelisBaseDevice
from .device import AristonDevice

Expand All @@ -22,7 +23,7 @@ def __init__(
attributes: dict[str, Any],
) -> None:
super().__init__(api, attributes)
self.plant_settings: dict[str, Any] = dict()
self.plant_settings: dict[str, Any] = {}

@property
@abstractmethod
Expand Down Expand Up @@ -88,6 +89,26 @@ async def async_set_max_setpoint_temp(self, max_setpoint_temp: float):
)
self.plant_settings[self.max_setpoint_temp] = max_setpoint_temp

@staticmethod
def _create_holiday_end_date(holiday_end: Optional[date]) -> Optional[str]:
return (
None
if holiday_end is None
else holiday_end.strftime(HOLIDAY_DATE_FORMAT)
)

def set_velis_holiday(self, holiday_end: Optional[date]) -> None:
"""Set Velis holiday on device"""
self.api.set_velis_slp_holiday(
self.gw, self._create_holiday_end_date(holiday_end)
)

async def async_set_velis_holiday(self, holiday_end: Optional[date]) -> None:
"""Async set Velis holiday on device"""
await self.api.async_set_velis_slp_holiday(
self.gw, self._create_holiday_end_date(holiday_end)
)

@property
@abstractmethod
def water_heater_maximum_setpoint_temperature_minimum(self) -> Optional[float]:
Expand Down
19 changes: 15 additions & 4 deletions tests/test_device_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,13 +312,19 @@ def test_nuos_split_properties_sync_async_and_missing_state_defaults(self):
device.set_heating_rate(5)
self.assertEqual(device.data[NuosSplitProperties.COMFORT_TEMP], 43)
self.assertEqual(device.data[NuosSplitProperties.REDUCED_TEMP], 42)
self.assertEqual(device.data[NuosSplitProperties.MODE], NuosSplitOperativeMode.FAST.value)
# opMode (operative mode) is echoed, not mode (plant mode — never
# changes on an operativeMode write, proven against the live API)
self.assertEqual(
device.data[NuosSplitProperties.OP_MODE],
NuosSplitOperativeMode.FAST.value,
)
device.api.set_nuos_temperature.assert_called_with("gw-1", 43, 42, 60, 40)
device.api.set_velis_plant_setting.assert_called()

device.api.async_set_nous_boost = AsyncMock()
device.api.async_set_nuos_temperature = AsyncMock()
device.api.async_set_nuos_mode = AsyncMock()
device.api.async_set_nuos_mode_via_r2 = AsyncMock()
device.api.async_set_velis_plant_setting = AsyncMock()

async def set_values():
Expand All @@ -335,7 +341,10 @@ async def set_values():

asyncio.run(set_values())
self.assertTrue(device.data[NuosSplitProperties.BOOST_ON])
self.assertEqual(device.data[NuosSplitProperties.MODE], NuosSplitOperativeMode.GREEN.value)
self.assertEqual(
device.data[NuosSplitProperties.OP_MODE],
NuosSplitOperativeMode.GREEN.value,
)
self.assertEqual(device.plant_settings[SlpDeviceSettings.SLP_HEATING_RATE], 4)
self.assertEqual(device.api.async_set_velis_plant_setting.await_count, 3)

Expand Down Expand Up @@ -429,7 +438,8 @@ def test_nuos_split_green_plus_mode_is_exposed_and_settable(self):

device.set_water_heater_operation_mode("GREEN_PLUS")
self.assertEqual(
device.data[NuosSplitProperties.MODE], NuosSplitOperativeMode.GREEN_PLUS.value
device.data[NuosSplitProperties.OP_MODE],
NuosSplitOperativeMode.GREEN_PLUS.value,
)
device.api.set_nuos_mode.assert_called_once_with(
"gw-1", NuosSplitOperativeMode.GREEN_PLUS
Expand All @@ -438,7 +448,8 @@ def test_nuos_split_green_plus_mode_is_exposed_and_settable(self):
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.data[NuosSplitProperties.OP_MODE],
NuosSplitOperativeMode.GREEN_PLUS.value,
)
device.api.async_set_nuos_mode.assert_awaited_once_with(
"gw-1", NuosSplitOperativeMode.GREEN_PLUS
Expand Down
Loading
Loading