[go: nahoru, domu]

Skip to content

Commit

Permalink
Remove and update deprecated constants
Browse files Browse the repository at this point in the history
  • Loading branch information
qqaatw committed May 15, 2024
1 parent f1254f7 commit 6b35204
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion custom_components/jcihitachi_tw/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def unique_id(self):
return f"{self._thing.gateway_mac_address}_climate"

def calculate_supported_features(self):
support_flags = ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.FAN_MODE | ClimateEntityFeature.PRESET_MODE
support_flags = ClimateEntityFeature.TURN_ON | ClimateEntityFeature.TURN_OFF | ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.FAN_MODE | ClimateEntityFeature.PRESET_MODE
if self._thing.support_code.HorizontalWindDirectionSetting != "unsupported" and \
self._thing.support_code.VerticalWindDirectionSwitch != "unsupported":
support_flags |= ClimateEntityFeature.SWING_MODE
Expand Down
7 changes: 3 additions & 4 deletions custom_components/jcihitachi_tw/fan.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
"""JciHitachi integration."""
import logging

from homeassistant.components.fan import (SUPPORT_PRESET_MODE,
SUPPORT_SET_SPEED, FanEntity)
from homeassistant.components.fan import (FanEntity, FanEntityFeature)
from homeassistant.util.percentage import (ordered_list_item_to_percentage,
percentage_to_ordered_list_item)

Expand Down Expand Up @@ -108,9 +107,9 @@ def unique_id(self):
def calculate_supported_features(self):
support_flags = 0
if self._thing.support_code.FanSpeed != "unsupported":
support_flags |= SUPPORT_SET_SPEED
support_flags |= FanEntityFeature.SET_SPEED
if self._thing.support_code.FanSpeed & 1 == 1: # auto mode is at the first bit.
support_flags |= SUPPORT_PRESET_MODE
support_flags |= FanEntityFeature.PRESET_MODE

return support_flags

Expand Down

0 comments on commit 6b35204

Please sign in to comment.