Skip to content

Commit

Permalink
Update entities.py
Browse files Browse the repository at this point in the history
  • Loading branch information
OStrama authored Nov 20, 2024
1 parent cd5d16d commit 4b0a72d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions custom_components/weishaupt_modbus/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def translate_val(self, val) -> float:
case FORMATS.PERCENTAGE:
return self.calc_percentage(val)
case FORMATS.STATUS:
return self._modbus_item.get_translation_key_from_number(val)
return self._modbus_item.get_text_from_number(val) #translation_key_from_number(val)
case FORMATS.UNKNOWN:
return int(val)
case _:
Expand All @@ -269,7 +269,7 @@ def retranslate_val(self, value) -> int:
match self._modbus_item.format:
# logically, this belongs to the ModbusItem, but doing it here
case FORMATS.STATUS:
val = self._modbus_item.get_number_from_translation_key(value)
val = self._modbus_item.get_number_from_text(val) #translation_key(value)
case _:
val = value * self._divider
return val
Expand All @@ -286,8 +286,8 @@ def my_device_info(self) -> DeviceInfo:
"""Build the device info."""
return {
"identifiers": {(CONST.DOMAIN, self._dev_device)},
# "name": self._dev_device,
"translation_key": self._dev_device,
"name": self._dev_device,
# "translation_key": self._dev_device,
"sw_version": "Device_SW_Version",
"model": "Device_model",
"manufacturer": "Weishaupt",
Expand Down Expand Up @@ -468,7 +468,7 @@ def __init__(
# option list build from the status list of the ModbusItem
self.options = []
for _useless, item in enumerate(self._modbus_item._resultlist):
self.options.append(item.translation_key)
self.options.append(item.text) #translation_key)

async def async_select_option(self, option: str) -> None:
# the synching is done by the ModbusObject of the entity
Expand Down

0 comments on commit 4b0a72d

Please sign in to comment.