Skip to content

Commit

Permalink
Fix calling permanent off with nexia (#73623)
Browse files Browse the repository at this point in the history
* Fix calling permanent off with nexia

Changelog: bdraco/nexia@1.0.1...1.0.2

Fixes #73610

* one more
  • Loading branch information
bdraco authored and frenck committed Jun 22, 2022
1 parent 1551177 commit 65c1d48
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
4 changes: 3 additions & 1 deletion homeassistant/components/nexia/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,9 @@ async def async_turn_on(self):

async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None:
"""Set the system mode (Auto, Heat_Cool, Cool, Heat, etc)."""
if hvac_mode == HVACMode.AUTO:
if hvac_mode == HVACMode.OFF:
await self._zone.call_permanent_off()
elif hvac_mode == HVACMode.AUTO:
await self._zone.call_return_to_schedule()
await self._zone.set_mode(mode=OPERATION_MODE_AUTO)
else:
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/nexia/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"domain": "nexia",
"name": "Nexia/American Standard/Trane",
"requirements": ["nexia==1.0.1"],
"requirements": ["nexia==1.0.2"],
"codeowners": ["@bdraco"],
"documentation": "https://www.home-assistant.io/integrations/nexia",
"config_flow": true,
Expand Down
6 changes: 5 additions & 1 deletion homeassistant/components/nexia/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from typing import Any

from nexia.const import OPERATION_MODE_OFF
from nexia.home import NexiaHome
from nexia.thermostat import NexiaThermostat
from nexia.zone import NexiaThermostatZone
Expand Down Expand Up @@ -58,7 +59,10 @@ def icon(self) -> str:

async def async_turn_on(self, **kwargs: Any) -> None:
"""Enable permanent hold."""
await self._zone.call_permanent_hold()
if self._zone.get_current_mode() == OPERATION_MODE_OFF:
await self._zone.call_permanent_off()
else:
await self._zone.call_permanent_hold()
self._signal_zone_update()

async def async_turn_off(self, **kwargs: Any) -> None:
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1080,7 +1080,7 @@ nettigo-air-monitor==1.2.4
neurio==0.3.1

# homeassistant.components.nexia
nexia==1.0.1
nexia==1.0.2

# homeassistant.components.nextcloud
nextcloudmonitor==1.1.0
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ netmap==0.7.0.2
nettigo-air-monitor==1.2.4

# homeassistant.components.nexia
nexia==1.0.1
nexia==1.0.2

# homeassistant.components.discord
nextcord==2.0.0a8
Expand Down

0 comments on commit 65c1d48

Please sign in to comment.