docs: def encode_value_using_ma(message_attribute: int, value: Optional[Union[int, float]]) -> int:
      """Encode special sensor value using the message attribute."""
      if message_attribute == MA_TX3AC_100A:
          # TX-3AC in 100A mode; use value as-is, with 0xFE indicating null
          if value is None:
              return 0xfe
          return int(value)
      elif message_attribute == MA_TX3AC_10A:
          # TX-3AC in 10A mode; shift decimal point, with 0xFE indicating null
          if value is None:
              return 0xfe
          return int(value * 10)
      else:
          # Signed byte, with 0x80 indicating null
          if value is None:
              return 0x80
          elif value < 0:
              return 0x100 + int(value)
          return int(value)