Skip to content

Commit 2493b51

Browse files
Fixed set_temperature with hvac_mode
1 parent ec7912e commit 2493b51

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

custom_components/panasonic_cc/panasonic.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from homeassistant.util import Throttle
77
from homeassistant.const import ATTR_TEMPERATURE
88
from homeassistant.helpers.typing import HomeAssistantType
9+
from homeassistant.components.climate.const import ATTR_HVAC_MODE
910

1011
from .const import PRESET_LIST, OPERATION_LIST
1112

@@ -126,7 +127,6 @@ def nanoe_mode(self):
126127
return p['nanoe']
127128
return None
128129

129-
130130
async def turn_off(self):
131131
await self.hass.async_add_executor_job(
132132
self.set_device,
@@ -158,11 +158,18 @@ async def set_temperature(self, **kwargs):
158158
if target_temp is None:
159159
return
160160

161+
new_values = { "temperature": target_temp }
162+
163+
hvac_mode = kwargs.get(ATTR_HVAC_MODE)
164+
if hvac_mode is not None:
165+
new_values['power'] = self.constants.Power.On
166+
new_values['mode'] = self.constants.OperationMode[OPERATION_LIST[hvac_mode]]
167+
161168
_LOGGER.debug("Set %s temperature %s", self.name, target_temp)
162169

163170
await self.hass.async_add_executor_job(
164171
self.set_device,
165-
{ "temperature": target_temp }
172+
new_values
166173
)
167174
await self.do_update()
168175

0 commit comments

Comments
 (0)