Skip to content

Commit 39a6e68

Browse files
authored
Merge branch 'master' into jwi-logresponsetext
2 parents b1142b8 + 9806419 commit 39a6e68

File tree

5 files changed

+56
-29
lines changed

5 files changed

+56
-29
lines changed

custom_components/daikin_onecta/climate.py

+16-15
Original file line numberDiff line numberDiff line change
@@ -318,22 +318,23 @@ async def async_set_temperature(self, **kwargs):
318318
await self.async_set_hvac_mode(kwargs[ATTR_HVAC_MODE])
319319

320320
if ATTR_TEMPERATURE in kwargs:
321-
operationmode = self.operation_mode()
322-
omv = operationmode["value"]
323321
value = kwargs[ATTR_TEMPERATURE]
324-
res = await self._device.patch(
325-
self._device.id,
326-
self._embedded_id,
327-
"temperatureControl",
328-
f"/operationModes/{omv}/setpoints/{self._setpoint}",
329-
value,
330-
)
331-
# When updating the value to the daikin cloud worked update our local cached version
332-
if res:
333-
setpointdict = self.setpoint()
334-
if setpointdict is not None:
335-
self._attr_target_temperature = value
336-
self.async_write_ha_state()
322+
if self._attr_target_temperature != value:
323+
operationmode = self.operation_mode()
324+
omv = operationmode["value"]
325+
res = await self._device.patch(
326+
self._device.id,
327+
self._embedded_id,
328+
"temperatureControl",
329+
f"/operationModes/{omv}/setpoints/{self._setpoint}",
330+
value,
331+
)
332+
# When updating the value to the daikin cloud worked update our local cached version
333+
if res:
334+
setpointdict = self.setpoint()
335+
if setpointdict is not None:
336+
self._attr_target_temperature = value
337+
self.async_write_ha_state()
337338

338339
def get_hvac_mode(self):
339340
"""Return current HVAC mode."""

custom_components/daikin_onecta/manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
"iot_class": "cloud_polling",
99
"issue_tracker": "https://github.com/jwillemsen/daikin_onecta/issues",
1010
"requirements": [],
11-
"version": "4.1.5"
11+
"version": "4.1.7"
1212
}

custom_components/daikin_onecta/water_heater.py

+13-11
Original file line numberDiff line numberDiff line change
@@ -186,17 +186,19 @@ async def async_set_tank_temperature(self, value):
186186
self._device.name,
187187
)
188188
return None
189-
res = await self._device.patch(
190-
self._device.id,
191-
self._embedded_id,
192-
"temperatureControl",
193-
"/operationModes/heating/setpoints/domesticHotWaterTemperature",
194-
int(value),
195-
)
196-
# When updating the value to the daikin cloud worked update our local cached version
197-
if res:
198-
self._attr_target_temperature = value
199-
self.async_write_ha_state()
189+
190+
if int(value) != self._attr_target_temperature:
191+
res = await self._device.patch(
192+
self._device.id,
193+
self._embedded_id,
194+
"temperatureControl",
195+
"/operationModes/heating/setpoints/domesticHotWaterTemperature",
196+
int(value),
197+
)
198+
# When updating the value to the daikin cloud worked update our local cached version
199+
if res:
200+
self._attr_target_temperature = value
201+
self.async_write_ha_state()
200202

201203
async def async_set_temperature(self, **kwargs):
202204
"""Set new target temperature."""

readme.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ You will now be redirected to the Daikin website where you have to authorize the
3838

3939
Only when the redirect back to your Home Assistant doesn't work first try to install/enable [My Home Assistant](https://www.home-assistant.io/integrations/my/). When that also doesn't work you can try `<HOME_ASSISTANT_URL>/auth/external/callback` as the redirect URI instead. The `<HOME_ASSISTANT_URL>` must be the same as used during the configuration/authentication process. Internal examples: `http://192.168.0.2:8123/auth/external/callback`, `http://homeassistant.local:8123/auth/external/callback`.
4040

41-
When you try to reinstall this integration check if you don't have an old client id and secret configured within Home Assistant, see [Application Credentials](https://www.home-assistant.io/integrations/application_credentials/) for more information.
42-
4341
This integration supports the following configuration settings to reduce the amount of polling to Daikin
4442

4543
- High frequency period update interval (minutes)
@@ -48,6 +46,10 @@ This integration supports the following configuration settings to reduce the amo
4846
- Low frequency period start time
4947
- Number of seconds that a data refresh is ignored after a command
5048

49+
# Reinstall
50+
51+
When you try to reinstall this integration check if you don't have an old client id and secret configured within Home Assistant, see [Application Credentials](https://www.home-assistant.io/integrations/application_credentials/) for more information.
52+
5153
# Setting the log level
5254

5355
If you'd like to see more granular logs, to investigate the communication or for other debugging purposes, you can set the log level in the Home Assistant config. The following lines can be added to set the overall log level for the component and the oauth2 helper which this integration uses:

tests/test_init.py

+22
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,17 @@ async def test_water_heater(
296296
assert responses.calls[0].request.body == '{"value": 58, "path": "/operationModes/heating/setpoints/domesticHotWaterTemperature"}'
297297
assert hass.states.get("water_heater.altherma").attributes["temperature"] == 58
298298

299+
# Set the tank temperature to 58, this should not result in a call as it is already 58
300+
await hass.services.async_call(
301+
WATER_HEATER_DOMAIN,
302+
SERVICE_SET_TEMPERATURE,
303+
{ATTR_ENTITY_ID: "water_heater.altherma", ATTR_TEMPERATURE: 58},
304+
blocking=True,
305+
)
306+
await hass.async_block_till_done()
307+
308+
assert len(responses.calls) == 1
309+
299310
# Set the tank off, this should just work
300311
await hass.services.async_call(
301312
WATER_HEATER_DOMAIN,
@@ -637,6 +648,17 @@ async def test_climate(
637648
assert responses.calls[10].request.body == '{"value": 25.0, "path": "/operationModes/heating/setpoints/roomTemperature"}'
638649
assert hass.states.get("climate.werkkamer_room_temperature").attributes["temperature"] == 25
639650

651+
# Set the target temperature another time to 25, should not result in a call to Daikin
652+
await hass.services.async_call(
653+
CLIMATE_DOMAIN,
654+
SERVICE_SET_TEMPERATURE,
655+
{ATTR_ENTITY_ID: "climate.werkkamer_room_temperature", ATTR_TEMPERATURE: 25},
656+
blocking=True,
657+
)
658+
await hass.async_block_till_done()
659+
660+
assert len(responses.calls) == 11
661+
640662
# Set the hvac mode to cool and target temperature to 20 using one call
641663
await hass.services.async_call(
642664
CLIMATE_DOMAIN,

0 commit comments

Comments
 (0)