Skip to content

Commit

Permalink
- Pin down toshiba control library version.
Browse files Browse the repository at this point in the history
- Remove unused translation.
- Fix power selection.
- Remove unsupported swing modes
  • Loading branch information
h4de5 committed Aug 26, 2021
1 parent 4e412f6 commit a74cd18
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 79 deletions.
35 changes: 18 additions & 17 deletions custom_components/toshiba_ac/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,9 @@ def preset_mode(self) -> Optional[str]:
if not self.is_on:
return None

if self._device.ac_mode == ToshibaAcFcuState.AcPowerSelection.POWER_50:
if self._device.ac_power_selection == ToshibaAcFcuState.AcPowerSelection.POWER_50:
return "low_power"
elif self._device.ac_mode == ToshibaAcFcuState.AcPowerSelection.POWER_75:
elif self._device.ac_power_selection == ToshibaAcFcuState.AcPowerSelection.POWER_75:
return "mid_power"
else:
return "high_power"
Expand Down Expand Up @@ -311,29 +311,30 @@ def swing_modes(self) -> Optional[List[str]]:
Requires SUPPORT_SWING_MODE.
"""
return ["vertical", "horizontal", "vertical_horizontal", "fixed1", "fixed2", "fixed3", "fixed4", "fixed5", "off"]
return ["vertical", "off"]
# return ["vertical", "horizontal", "vertical_horizontal", "fixed1", "fixed2", "fixed3", "fixed4", "fixed5", "off"]

@property
def swing_mode(self) -> Optional[str]:
"""Return the swing setting.
Requires SUPPORT_SWING_MODE.
"""
if self._device.ac_fan_mode == ToshibaAcFcuState.AcSwingMode.SWING_VERTICAL:
return "auto"
elif self._device.ac_fan_mode == ToshibaAcFcuState.AcSwingMode.SWING_HORIZONTAL:
return "low"
elif self._device.ac_fan_mode == ToshibaAcFcuState.AcSwingMode.SWING_VERTICAL_AND_HORIZONTAL:
return "medium_low"
elif self._device.ac_fan_mode == ToshibaAcFcuState.AcSwingMode.FIXED_1:
if self._device.ac_swing_mode == ToshibaAcFcuState.AcSwingMode.SWING_VERTICAL:
return "vertical"
elif self._device.ac_swing_mode == ToshibaAcFcuState.AcSwingMode.SWING_HORIZONTAL:
return "horizontal"
elif self._device.ac_swing_mode == ToshibaAcFcuState.AcSwingMode.SWING_VERTICAL_AND_HORIZONTAL:
return "vertical_horizontal"
elif self._device.ac_swing_mode == ToshibaAcFcuState.AcSwingMode.FIXED_1:
return "fixed1"
elif self._device.ac_fan_mode == ToshibaAcFcuState.AcSwingMode.FIXED_2:
elif self._device.ac_swing_mode == ToshibaAcFcuState.AcSwingMode.FIXED_2:
return "fixed2"
elif self._device.ac_fan_mode == ToshibaAcFcuState.AcSwingMode.FIXED_3:
elif self._device.ac_swing_mode == ToshibaAcFcuState.AcSwingMode.FIXED_3:
return "fixed3"
elif self._device.ac_fan_mode == ToshibaAcFcuState.AcSwingMode.FIXED_4:
elif self._device.ac_swing_mode == ToshibaAcFcuState.AcSwingMode.FIXED_4:
return "fixed4"
elif self._device.ac_fan_mode == ToshibaAcFcuState.AcSwingMode.FIXED_5:
elif self._device.ac_swing_mode == ToshibaAcFcuState.AcSwingMode.FIXED_5:
return "fixed5"
else:
return "off"
Expand Down Expand Up @@ -429,11 +430,11 @@ async def async_set_swing_mode(self, swing_mode: str) -> None:
async def async_set_preset_mode(self, preset_mode: str) -> None:
"""Set new preset mode."""
if preset_mode == "low_power":
await self._device.ac_power_selection(ToshibaAcFcuState.AcPowerSelection.POWER_50)
await self._device.set_ac_power_selection(ToshibaAcFcuState.AcPowerSelection.POWER_50)
elif preset_mode == "mid_power":
await self._device.ac_power_selection(ToshibaAcFcuState.AcPowerSelection.POWER_75)
await self._device.set_ac_power_selection(ToshibaAcFcuState.AcPowerSelection.POWER_75)
elif preset_mode == "high_power":
await self._device.ac_power_selection(ToshibaAcFcuState.AcPowerSelection.POWER_100)
await self._device.set_ac_power_selection(ToshibaAcFcuState.AcPowerSelection.POWER_100)

@property
def min_temp(self) -> float:
Expand Down
6 changes: 2 additions & 4 deletions custom_components/toshiba_ac/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@
"config_flow": true,
"documentation": "https://github.com/h4de5/home-assistant-toshiba_ac",
"issue_tracker": "https://github.com/h4de5/home-assistant-toshiba_ac/issues",
"requirements": [
"toshiba_ac @ git+https://github.com/KaSroka/Toshiba-AC-control.git#egg=toshiba_ac"
],
"requirements": ["toshiba-ac==0.1.0"],
"ssdp": [],
"zeroconf": [],
"homekit": {},
"dependencies": [],
"codeowners": ["@h4de5"],
"version": "2021.8.3",
"version": "2021.8.4",
"iot_class": "cloud_push"
}
58 changes: 0 additions & 58 deletions custom_components/toshiba_ac/translations/en.json
Original file line number Diff line number Diff line change
@@ -1,62 +1,4 @@
{
"component": {
"climate": {
"state": {
"_": {
"auto": "Auto",
"quiet": "Silent",
"low": "Low",
"medium_low": "Medium-Low",
"medium": "Medium",
"medium_high": "Medium-High",
"high": "High",

"vertical": "Vertical",
"horizontal": "Horizontal",
"vertical_horizontal": "Vertical and Horizontal",
"fixed1": "Fixed Mode 1",
"fixed2": "Fixed Mode 2",
"fixed3": "Fixed Mode 3",
"fixed4": "Fixed Mode 4",
"fixed5": "Fixed Mode 5",
"off": "Off",

"low_power": "Low Power",
"mid_power": "Mid Power",
"high_power": "High Power"
}
}
}
},
"state_attributes": {
"climate": {
"fan_mode": {
"auto": "Auto",
"quiet": "Silent",
"low": "Low",
"medium_low": "Medium-Low",
"medium": "Medium",
"medium_high": "Medium-High",
"high": "High"
},
"swing_mode": {
"vertical": "Vertical",
"horizontal": "Horizontal",
"vertical_horizontal": "Vertical and Horizontal",
"fixed1": "Fixed Mode 1",
"fixed2": "Fixed Mode 2",
"fixed3": "Fixed Mode 3",
"fixed4": "Fixed Mode 4",
"fixed5": "Fixed Mode 5",
"off": "Off"
},
"preset_mode": {
"low_power": "Low Power",
"mid_power": "Mid Power",
"high_power": "High Power"
}
}
},
"config": {
"abort": {
"already_configured": "Device is already configured"
Expand Down

0 comments on commit a74cd18

Please sign in to comment.