Skip to content

Commit

Permalink
Fix #67
Browse files Browse the repository at this point in the history
  • Loading branch information
osk2 committed May 15, 2023
1 parent 227d65c commit d4f2b22
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions custom_components/panasonic_smart_app/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ def supported_features(self) -> int:
try:
_raw_swing_mode = int(status.get("0x0F", 0))
_swing_mode = CLIMATE_AVAILABLE_SWING_MODE[_raw_swing_mode]
except IndexError:
except KeyError:
_swing_mode = False

try:
_raw_fan_mode = int(status.get("0x02", 0))
_fan_mode = CLIMATE_AVAILABLE_FAN_MODE[_raw_fan_mode]
except IndexError:
except KeyError:
_fan_mode = False

if _swing_mode:
Expand Down
2 changes: 1 addition & 1 deletion custom_components/panasonic_smart_app/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def last_reset(self):
def state(self) -> int:
energy = self.coordinator.data[self.index]["energy"]
_LOGGER.debug(f"[{self.label}] state: {energy}")
return energy if energy >= 0 else STATE_UNAVAILABLE
return energy if energy is not None and energy >= 0 else STATE_UNAVAILABLE

@property
def state_class(self) -> str:
Expand Down

0 comments on commit d4f2b22

Please sign in to comment.