Skip to content
Open
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
14 changes: 14 additions & 0 deletions src/tadoasync/models_v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,15 @@ class AcPower(DataClassORJSONMixin):
value: str


@dataclass
class HotWaterInUse(DataClassORJSONMixin):
"""HotWaterInUse model represents the hot water activity state."""

type: str
timestamp: str
value: str


@dataclass
class Humidity(DataClassORJSONMixin):
"""Humidity model represents the humidity."""
Expand Down Expand Up @@ -589,6 +598,8 @@ def __pre_deserialize__(cls, d: dict[str, Any]) -> dict[str, Any]:
"""Pre deserialize hook."""
if not d["sensorDataPoints"]:
d["sensorDataPoints"] = None
if d.get("nextTimeBlock") is None:
d["nextTimeBlock"] = {}
return d


Expand Down Expand Up @@ -624,6 +635,9 @@ class ActivityDataPoints(DataClassORJSONMixin):
heating_power: HeatingPower | None = field(
default=None, metadata=field_options(alias="heatingPower")
)
hot_water_in_use: HotWaterInUse | None = field(
default=None, metadata=field_options(alias="hotWaterInUse")
)


@dataclass
Expand Down
5 changes: 4 additions & 1 deletion src/tadoasync/tadoasync.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,10 @@ async def set_meter_readings(

payload = {"date": date.strftime("%Y-%m-%d"), "reading": reading}
response = await self._request(
endpoint=EIQ_HOST_URL, data=payload, method=HttpMethod.POST
f"homes/{self._home_id}/meterReadings",
endpoint=EIQ_HOST_URL,
data=payload,
method=HttpMethod.POST,
)
data = orjson.loads(response)
if "message" in data:
Expand Down
27 changes: 27 additions & 0 deletions tests/__snapshots__/test_tado.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,7 @@
'value': 'OFF',
}),
'heating_power': None,
'hot_water_in_use': None,
}),
'available': True,
'connection': None,
Expand Down Expand Up @@ -882,6 +883,7 @@
'value': 'ON',
}),
'heating_power': None,
'hot_water_in_use': None,
}),
'available': True,
'connection': None,
Expand Down Expand Up @@ -985,6 +987,7 @@
'value': 'ON',
}),
'heating_power': None,
'hot_water_in_use': None,
}),
'available': True,
'connection': None,
Expand Down Expand Up @@ -1098,6 +1101,7 @@
'value': 'ON',
}),
'heating_power': None,
'hot_water_in_use': None,
}),
'available': True,
'connection': None,
Expand Down Expand Up @@ -1201,6 +1205,7 @@
'value': 'ON',
}),
'heating_power': None,
'hot_water_in_use': None,
}),
'available': True,
'connection': None,
Expand Down Expand Up @@ -1304,6 +1309,7 @@
'value': 'ON',
}),
'heating_power': None,
'hot_water_in_use': None,
}),
'available': True,
'connection': None,
Expand Down Expand Up @@ -1417,6 +1423,7 @@
'value': 'OFF',
}),
'heating_power': None,
'hot_water_in_use': None,
}),
'available': True,
'connection': None,
Expand Down Expand Up @@ -1520,6 +1527,7 @@
'value': 'OFF',
}),
'heating_power': None,
'hot_water_in_use': None,
}),
'available': True,
'connection': None,
Expand Down Expand Up @@ -1623,6 +1631,7 @@
'value': 'OFF',
}),
'heating_power': None,
'hot_water_in_use': None,
}),
'available': True,
'connection': None,
Expand Down Expand Up @@ -1736,6 +1745,7 @@
'value': 'OFF',
}),
'heating_power': None,
'hot_water_in_use': None,
}),
'available': True,
'connection': None,
Expand Down Expand Up @@ -1825,6 +1835,7 @@
'value': 'ON',
}),
'heating_power': None,
'hot_water_in_use': None,
}),
'available': True,
'connection': None,
Expand Down Expand Up @@ -1928,6 +1939,7 @@
'value': 'ON',
}),
'heating_power': None,
'hot_water_in_use': None,
}),
'available': True,
'connection': None,
Expand Down Expand Up @@ -2036,6 +2048,7 @@
'type': 'PERCENTAGE',
'value': None,
}),
'hot_water_in_use': None,
}),
'available': True,
'connection': None,
Expand Down Expand Up @@ -2144,6 +2157,7 @@
'type': 'PERCENTAGE',
'value': None,
}),
'hot_water_in_use': None,
}),
'available': True,
'connection': None,
Expand Down Expand Up @@ -2276,6 +2290,7 @@
'type': 'PERCENTAGE',
'value': None,
}),
'hot_water_in_use': None,
}),
'available': True,
'connection': None,
Expand Down Expand Up @@ -2421,6 +2436,7 @@
'type': 'PERCENTAGE',
'value': None,
}),
'hot_water_in_use': None,
}),
'available': True,
'connection': None,
Expand Down Expand Up @@ -2562,6 +2578,7 @@
'type': 'PERCENTAGE',
'value': None,
}),
'hot_water_in_use': None,
}),
'available': True,
'connection': None,
Expand Down Expand Up @@ -2707,6 +2724,7 @@
'type': 'PERCENTAGE',
'value': None,
}),
'hot_water_in_use': None,
}),
'available': True,
'connection': None,
Expand Down Expand Up @@ -2824,6 +2842,7 @@
'activity_data_points': dict({
'ac_power': None,
'heating_power': None,
'hot_water_in_use': None,
}),
'available': True,
'connection': None,
Expand Down Expand Up @@ -2906,6 +2925,7 @@
'activity_data_points': dict({
'ac_power': None,
'heating_power': None,
'hot_water_in_use': None,
}),
'available': True,
'connection': None,
Expand Down Expand Up @@ -3012,6 +3032,7 @@
'activity_data_points': dict({
'ac_power': None,
'heating_power': None,
'hot_water_in_use': None,
}),
'available': True,
'connection': None,
Expand Down Expand Up @@ -3113,6 +3134,7 @@
'value': 'ON',
}),
'heating_power': None,
'hot_water_in_use': None,
}),
'available': True,
'connection': None,
Expand Down Expand Up @@ -3218,6 +3240,7 @@
'value': 'ON',
}),
'heating_power': None,
'hot_water_in_use': None,
}),
'available': True,
'connection': None,
Expand Down Expand Up @@ -3324,6 +3347,7 @@
'type': 'PERCENTAGE',
'value': None,
}),
'hot_water_in_use': None,
}),
'available': True,
'connection': None,
Expand Down Expand Up @@ -3454,6 +3478,7 @@
'type': 'PERCENTAGE',
'value': None,
}),
'hot_water_in_use': None,
}),
'available': True,
'connection': None,
Expand Down Expand Up @@ -3566,6 +3591,7 @@
'type': 'PERCENTAGE',
'value': None,
}),
'hot_water_in_use': None,
}),
'available': True,
'connection': None,
Expand Down Expand Up @@ -3696,6 +3722,7 @@
'type': 'PERCENTAGE',
'value': None,
}),
'hot_water_in_use': None,
}),
'available': True,
'connection': None,
Expand Down
4 changes: 2 additions & 2 deletions tests/test_tado.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ async def test_add_meter_readings_success(
) -> None:
"""Test adding meter readings."""
responses.post(
TADO_EIQ_URL,
f"{TADO_EIQ_URL}/homes/1/meterReadings",
body=load_fixture(folder="meter", filename="add_reading_success.json"),
)
await python_tado.set_meter_readings(5)
Expand All @@ -650,7 +650,7 @@ async def test_add_meter_readings_duplicated(
date = datetime(2023, 10, 1, 12, 0, 0, tzinfo=UTC)
reading = 5
responses.post(
TADO_EIQ_URL,
f"{TADO_EIQ_URL}/homes/1/meterReadings",
body=load_fixture(folder="meter", filename="add_reading_duplicate.json"),
)
with pytest.raises(
Expand Down