diff --git a/src/tadoasync/models_v3.py b/src/tadoasync/models_v3.py index 58a794e..2f59519 100644 --- a/src/tadoasync/models_v3.py +++ b/src/tadoasync/models_v3.py @@ -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.""" @@ -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 @@ -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 diff --git a/src/tadoasync/tadoasync.py b/src/tadoasync/tadoasync.py index 3dd0422..a8fece5 100644 --- a/src/tadoasync/tadoasync.py +++ b/src/tadoasync/tadoasync.py @@ -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: diff --git a/tests/__snapshots__/test_tado.ambr b/tests/__snapshots__/test_tado.ambr index c7df62c..e71cc97 100644 --- a/tests/__snapshots__/test_tado.ambr +++ b/tests/__snapshots__/test_tado.ambr @@ -769,6 +769,7 @@ 'value': 'OFF', }), 'heating_power': None, + 'hot_water_in_use': None, }), 'available': True, 'connection': None, @@ -882,6 +883,7 @@ 'value': 'ON', }), 'heating_power': None, + 'hot_water_in_use': None, }), 'available': True, 'connection': None, @@ -985,6 +987,7 @@ 'value': 'ON', }), 'heating_power': None, + 'hot_water_in_use': None, }), 'available': True, 'connection': None, @@ -1098,6 +1101,7 @@ 'value': 'ON', }), 'heating_power': None, + 'hot_water_in_use': None, }), 'available': True, 'connection': None, @@ -1201,6 +1205,7 @@ 'value': 'ON', }), 'heating_power': None, + 'hot_water_in_use': None, }), 'available': True, 'connection': None, @@ -1304,6 +1309,7 @@ 'value': 'ON', }), 'heating_power': None, + 'hot_water_in_use': None, }), 'available': True, 'connection': None, @@ -1417,6 +1423,7 @@ 'value': 'OFF', }), 'heating_power': None, + 'hot_water_in_use': None, }), 'available': True, 'connection': None, @@ -1520,6 +1527,7 @@ 'value': 'OFF', }), 'heating_power': None, + 'hot_water_in_use': None, }), 'available': True, 'connection': None, @@ -1623,6 +1631,7 @@ 'value': 'OFF', }), 'heating_power': None, + 'hot_water_in_use': None, }), 'available': True, 'connection': None, @@ -1736,6 +1745,7 @@ 'value': 'OFF', }), 'heating_power': None, + 'hot_water_in_use': None, }), 'available': True, 'connection': None, @@ -1825,6 +1835,7 @@ 'value': 'ON', }), 'heating_power': None, + 'hot_water_in_use': None, }), 'available': True, 'connection': None, @@ -1928,6 +1939,7 @@ 'value': 'ON', }), 'heating_power': None, + 'hot_water_in_use': None, }), 'available': True, 'connection': None, @@ -2036,6 +2048,7 @@ 'type': 'PERCENTAGE', 'value': None, }), + 'hot_water_in_use': None, }), 'available': True, 'connection': None, @@ -2144,6 +2157,7 @@ 'type': 'PERCENTAGE', 'value': None, }), + 'hot_water_in_use': None, }), 'available': True, 'connection': None, @@ -2276,6 +2290,7 @@ 'type': 'PERCENTAGE', 'value': None, }), + 'hot_water_in_use': None, }), 'available': True, 'connection': None, @@ -2421,6 +2436,7 @@ 'type': 'PERCENTAGE', 'value': None, }), + 'hot_water_in_use': None, }), 'available': True, 'connection': None, @@ -2562,6 +2578,7 @@ 'type': 'PERCENTAGE', 'value': None, }), + 'hot_water_in_use': None, }), 'available': True, 'connection': None, @@ -2707,6 +2724,7 @@ 'type': 'PERCENTAGE', 'value': None, }), + 'hot_water_in_use': None, }), 'available': True, 'connection': None, @@ -2824,6 +2842,7 @@ 'activity_data_points': dict({ 'ac_power': None, 'heating_power': None, + 'hot_water_in_use': None, }), 'available': True, 'connection': None, @@ -2906,6 +2925,7 @@ 'activity_data_points': dict({ 'ac_power': None, 'heating_power': None, + 'hot_water_in_use': None, }), 'available': True, 'connection': None, @@ -3012,6 +3032,7 @@ 'activity_data_points': dict({ 'ac_power': None, 'heating_power': None, + 'hot_water_in_use': None, }), 'available': True, 'connection': None, @@ -3113,6 +3134,7 @@ 'value': 'ON', }), 'heating_power': None, + 'hot_water_in_use': None, }), 'available': True, 'connection': None, @@ -3218,6 +3240,7 @@ 'value': 'ON', }), 'heating_power': None, + 'hot_water_in_use': None, }), 'available': True, 'connection': None, @@ -3324,6 +3347,7 @@ 'type': 'PERCENTAGE', 'value': None, }), + 'hot_water_in_use': None, }), 'available': True, 'connection': None, @@ -3454,6 +3478,7 @@ 'type': 'PERCENTAGE', 'value': None, }), + 'hot_water_in_use': None, }), 'available': True, 'connection': None, @@ -3566,6 +3591,7 @@ 'type': 'PERCENTAGE', 'value': None, }), + 'hot_water_in_use': None, }), 'available': True, 'connection': None, @@ -3696,6 +3722,7 @@ 'type': 'PERCENTAGE', 'value': None, }), + 'hot_water_in_use': None, }), 'available': True, 'connection': None, diff --git a/tests/test_tado.py b/tests/test_tado.py index eaad4c5..1e9f08a 100644 --- a/tests/test_tado.py +++ b/tests/test_tado.py @@ -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) @@ -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(