Skip to content

Commit

Permalink
bugfixing
Browse files Browse the repository at this point in the history
  • Loading branch information
OStrama committed Oct 17, 2024
1 parent 9d47f94 commit c99cb0e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions custom_components/weishaupt_modbus/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ def calcPercentage(self,val: float):
def translateVal(self):
# reads an translates a value from the modbus
mbo = ModbusObject(self._config_entry, self._modbus_item)
if mbo == None:
return None
val = mbo.value
match self._modbus_item.format:
case FORMATS.TEMPERATUR:
Expand All @@ -104,6 +106,8 @@ def translateVal(self):
def translateVal(self,value):
# translates and writes a value to the modbus
mbo = ModbusObject(self._config_entry, self._modbus_item)
if mbo == None:
return
val = None
match self._modbus_item.format:
# logically, this belongs to the ModbusItem, but doing it here
Expand Down Expand Up @@ -168,9 +172,13 @@ def translateVal(self):

mb_x = ModbusItem(self._modbus_item.getNumberFromText("x"),"x",FORMATS.TEMPERATUR,TYPES.SENSOR_CALC,DEVICES.SYS, TEMPRANGE_STD)
mbo_x = ModbusObject(self._config_entry, mb_x)
if mbo_x == None:
return None
val_x = self.calcTemperature(mbo_x.value) / 10
mb_y = ModbusItem(self._modbus_item.getNumberFromText("y"),"y",FORMATS.TEMPERATUR,TYPES.SENSOR_CALC,DEVICES.WP, TEMPRANGE_STD)
mbo_y = ModbusObject(self._config_entry, mb_y)
if mbo_x == None:
return None
val_y = self.calcTemperature(mbo_y.value) / 10

match self._modbus_item.format:
Expand Down

0 comments on commit c99cb0e

Please sign in to comment.