Skip to content

Commit

Permalink
Fix on error state sensor
Browse files Browse the repository at this point in the history
  • Loading branch information
efipso committed Aug 18, 2024
1 parent fbfa462 commit 280c18b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions custom_components/melcloud_custom/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

from dataclasses import dataclass
import dataclasses
from collections.abc import Callable
from typing import Any

Expand All @@ -21,7 +21,7 @@
from .pymelcloud import DEVICE_TYPE_ATA, DEVICE_TYPE_ATW


@dataclass
@dataclasses.dataclass(frozen=True, kw_only=True)
class MelcloudBinarySensorEntityDescription(BinarySensorEntityDescription):
"""Describes Melcloud binary sensor entity."""

Expand Down
4 changes: 2 additions & 2 deletions custom_components/melcloud_custom/pymelcloud/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def wifi_signal(self) -> Optional[int]:
@property
def has_error(self) -> bool:
"""Return True if the device has error state."""
if self.device_conf is None:
if self._device_conf is None:
return False
return self._device_conf.get("Device", {}).get("HasError", False)

Expand All @@ -217,6 +217,6 @@ def error_code(self) -> Optional[str]:
This is a property that probably should be checked if "has_error" = true
Till now I have a fixed code = 8000 and never have error on the units
"""
if self.device_conf is None:
if self._device_conf is None:
return None
return self._device_conf.get("Device", {}).get("ErrorCode", None)
4 changes: 3 additions & 1 deletion custom_components/melcloud_custom/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@
},
"wifi_signal": {
"name": "Wifi Signal Strength"
},
}
},
"binary_sensor": {
"error_state": {
"name": "Error State"
}
Expand Down

0 comments on commit 280c18b

Please sign in to comment.